Help setting up Ms-Access Database
Help setting up Ms-Access Database
am 03.12.2007 01:12:42 von Jeffrey Davis
I'm hoping that someone here can give me some assistance with a
database I'm trying to set up. My skills in Access are fairly basic,
and I'm trying to skill up, but some of the stuff is a little opaque.
I'm trying to put some data I've got on paper into Access. Recently,
I
got together with some other people marketing organic produce and
offered to do some marketing for us on a coop basis in the city.
The idea I had was to have four marketing packages for coop members
with different rates and services. For want of something better lets
call them P1, P2, P3 & P4
I'm thinking I'll need a table with the packages, and one listing the
coop members with their details. In theory, a coop member might
acquire another farm (either a new one or one from someone bailing
out) and put it on a separate package.
Which tables would have to have a relationship?
I'm thinking the packages table containing the dat about each package
would have to be related via a common field to the coop member table,
and there would probably have to be a link between that and the farm
table, through common fields -- maybe a unique ID in the coop member
table could appear in the farm table and maybe the primary key from
the package table could also appear in the farm table as a foreign
key. But am I right?
I'd also like to create a form that would list an individual coop
member's details plus any packages they own and assume that all I'd
need to do would be to ensure that there was a specified report for
the form to call. Is that right? Is 'switchboard manager' the way to
go here?
I'd also like to create a macro to automatically open the database.
I've had a bit of a look through Access and maybe I've missed it, but
could someone point me in the right direction?
Thanks in advance ...
JD
PS Further to this, it occurs to me that if I'm going to permit coop
members to have more than one package then maybe I need some sort of
transactions table in which the records would be packages actually
taken out. Each record could contain the ID from the relevant farm
(the transactions table being the 'one' and the farm being the many)
and an ID from the packages table (eg P1 to P4) where the
transactions
table could be the many.
Am I in a muddle here or on the right track?
JD
PPS ... Bob Badour suggested I clarify the following questions:
"How many packages can a farm have? "
only 1
"How many packages can a coop member have?"
in theory, unlimited, although only one per farm
"How many farms can a coop member have?"
in theory, unlimited
"How many coop members can a farm have?"
just one
Any assistance would be greatly valued.
JD
Selecting records using criteria as arguments for a mathematical
am 03.12.2007 05:15:53 von Jeffrey Davis
On Dec 3, 11:12 am, Jeffrey Davis wrote:
> I'm hoping that someone here can give me some assistance with a
> database I'm trying to set up. My skills in Access are fairly basic,
> and I'm trying to skill up, but some of the stuff is a little opaque.
>
> I'm trying to put some data I've got on paper into Access. Recently,
> I
> got together with some other people marketing organic produce and
> offered to do some marketing for us on a coop basis in the city.
>
> The idea I had was to have four marketing packages for coop members
> with different rates and services. For want of something better lets
> call them P1, P2, P3 & P4
>
> I'm thinking I'll need a table with the packages, and one listing the
> coop members with their details. In theory, a coop member might
> acquire another farm (either a new one or one from someone bailing
> out) and put it on a separate package.
>
> Which tables would have to have a relationship?
>
> I'm thinking the packages table containing the dat about each package
> would have to be related via a common field to the coop member table,
> and there would probably have to be a link between that and the farm
> table, through common fields -- maybe a unique ID in the coop member
> table could appear in the farm table and maybe the primary key from
> the package table could also appear in the farm table as a foreign
> key. But am I right?
>
> I'd also like to create a form that would list an individual coop
> member's details plus any packages they own and assume that all I'd
> need to do would be to ensure that there was a specified report for
> the form to call. Is that right? Is 'switchboard manager' the way to
> go here?
>
> I'd also like to create a macro to automatically open the database.
> I've had a bit of a look through Access and maybe I've missed it, but
> could someone point me in the right direction?
>
> Thanks in advance ...
>
> JD
>
> PS Further to this, it occurs to me that if I'm going to permit coop
> members to have more than one package then maybe I need some sort of
> transactions table in which the records would be packages actually
> taken out. Each record could contain the ID from the relevant farm
> (the transactions table being the 'one' and the farm being the many)
> and an ID from the packages table (eg P1 to P4) where the
> transactions
> table could be the many.
>
> Am I in a muddle here or on the right track?
>
> JD
Ok ,,, I've done the above ... not perfect but workable (still haven't
figured out how to create the macro) ,,,
but I'm trying to build a query that calculates the sum of a number of
records selected by the meeting the value of another field.
I keep getting type mismatches when I try to insert the criterion.
If I better specified (eg by specifying the fuill field and table name
in the correct syntax), would this work?
TIA
JD
Re: Selecting records using criteria as arguments for a mathematical operation
am 03.12.2007 10:06:50 von Tom van Stiphout
On Sun, 2 Dec 2007 20:15:53 -0800 (PST), Jeffrey Davis
wrote:
Show us your query and the data types of the fields involved. The
error message seems to indicate you're doing something that violates
the data type rules. E.g. Sum(FirstName) would trigger this error, or
"...where FirstName=Tom" (because the quotes are missing).
To start your application, set a startup form, or create an AutoExec
macro.
-Tom.
>
>Ok ,,, I've done the above ... not perfect but workable (still haven't
>figured out how to create the macro) ,,,
>
>but I'm trying to build a query that calculates the sum of a number of
>records selected by the meeting the value of another field.
>
>I keep getting type mismatches when I try to insert the criterion.
>
>If I better specified (eg by specifying the fuill field and table name
>in the correct syntax), would this work?
>
>TIA
>
>JD
Re: Selecting records using criteria as arguments for a mathematical
am 03.12.2007 11:17:19 von Jeffrey Davis
On Dec 3, 8:06 pm, Tom van Stiphout wrote:
> On Sun, 2 Dec 2007 20:15:53 -0800 (PST), Jeffrey Davis
>
> wrote:
>
> Show us your query and the data types of the fields involved. The
> error message seems to indicate you're doing something that violates
> the data type rules. E.g. Sum(FirstName) would trigger this error, or
> "...where FirstName=Tom" (because the quotes are missing).
>
> To start your application, set a startup form, or create an AutoExec
> macro.
>
> -Tom.
>
>
>
>
>
>
>
> >Ok ,,, I've done the above ... not perfect but workable (still haven't
> >figured out how to create the macro) ,,,
>
> >but I'm trying to build a query that calculates the sum of a number of
> >records selected by the meeting the value of another field.
>
> >I keep getting type mismatches when I try to insert the criterion.
>
> >If I better specified (eg by specifying the fuill field and table name
> >in the correct syntax), would this work?
>
> >TIA
>
> >JD- Hide quoted text -
>
> - Show quoted text -
I've just used the standard query app..
When it's run, it accurately extracts the relevant records with the
sales figures displayed for each of them.
SELECT package.Type, farms.Location, farms.farmID, farms.State,
farms.Sales
FROM farms INNER JOIN (coopMember INNER JOIN (package INNER JOIN
agreements ON package.Type = agreements.package) ON
coopMember.coopMemberID = agreements.coopMember) ON farms.farmID =
agreements.Restaurant
GROUP BY package.Type, farms.Location, farms.farmID, farms.State,
farms.Sales
HAVING (((package.Type)="p1"))
I tried to write some script to sum the three extracted records (i.e
all those with p1 as the value of the package type) in a new column,
but no dice.
In Excel, this would be fairly easy as you'd simply write an IF
referenced to the column with the p values specifying p1 and then sum
them at the bottom of the column, but in Access ...
Thanks.
JD
Re: Selecting records using criteria as arguments for a mathematical operation
am 03.12.2007 14:24:46 von Salad
Jeffrey Davis wrote:
> On Dec 3, 8:06 pm, Tom van Stiphout wrote:
>
>>On Sun, 2 Dec 2007 20:15:53 -0800 (PST), Jeffrey Davis
>>
>> wrote:
>>
>>Show us your query and the data types of the fields involved. The
>>error message seems to indicate you're doing something that violates
>>the data type rules. E.g. Sum(FirstName) would trigger this error, or
>>"...where FirstName=Tom" (because the quotes are missing).
>>
>>To start your application, set a startup form, or create an AutoExec
>>macro.
>>
>>-Tom.
>>
>>
>>
>>
>>
>>
>>
>>>Ok ,,, I've done the above ... not perfect but workable (still haven't
>>>figured out how to create the macro) ,,,
>>
>>>but I'm trying to build a query that calculates the sum of a number of
>>>records selected by the meeting the value of another field.
>>
>>>I keep getting type mismatches when I try to insert the criterion.
>>
>>>If I better specified (eg by specifying the fuill field and table name
>>>in the correct syntax), would this work?
>>
>>>TIA
>>
>>>JD- Hide quoted text -
>>
>>- Show quoted text -
>
>
> I've just used the standard query app..
>
> When it's run, it accurately extracts the relevant records with the
> sales figures displayed for each of them.
>
> SELECT package.Type, farms.Location, farms.farmID, farms.State,
> farms.Sales
> FROM farms INNER JOIN (coopMember INNER JOIN (package INNER JOIN
> agreements ON package.Type = agreements.package) ON
> coopMember.coopMemberID = agreements.coopMember) ON farms.farmID =
> agreements.Restaurant
> GROUP BY package.Type, farms.Location, farms.farmID, farms.State,
> farms.Sales
> HAVING (((package.Type)="p1"))
>
> I tried to write some script to sum the three extracted records (i.e
> all those with p1 as the value of the package type) in a new column,
> but no dice.
In the Totals row of the query builder (where you see all those
GroupBys), have you considered changing the Sales column from GroupBy to
Sum?
>
>
> In Excel, this would be fairly easy as you'd simply write an IF
> referenced to the column with the p values specifying p1 and then sum
> them at the bottom of the column, but in Access ...
>
> Thanks.
>
> JD
>
>
>
>
>