Re: Selecting records using criteria as arguments for a mathematical operation
- From: Salad <oil@xxxxxxxxxxx>
- Date: Mon, 03 Dec 2007 05:24:46 -0800
Jeffrey Davis wrote:
On Dec 3, 8:06 pm, Tom van Stiphout <no.spam.tom7...@xxxxxxx> wrote:
On Sun, 2 Dec 2007 20:15:53 -0800 (PST), Jeffrey Davis
<jpm1...@xxxxxxxxx> 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.
<clip>
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
- References:
- Help setting up Ms-Access Database
- From: Jeffrey Davis
- Selecting records using criteria as arguments for a mathematical operation
- From: Jeffrey Davis
- Re: Selecting records using criteria as arguments for a mathematical operation
- From: Tom van Stiphout
- Re: Selecting records using criteria as arguments for a mathematical operation
- From: Jeffrey Davis
- Help setting up Ms-Access Database
- Prev by Date: Re: Citrix headache...
- Next by Date: Re: Citrix headache...
- Previous by thread: Re: Selecting records using criteria as arguments for a mathematical operation
- Next by thread: Re: Am I wrong?
- Index(es):
Relevant Pages
|