Adding up expression not working in query ?

KarenYT
3StarLounger
Posts: 212
Joined: 28 Mar 2011, 18:29
Location: Netherlands

Adding up expression not working in query ?

Post by KarenYT »

When I try to add up the number columns, I have the following Error msg even though I have changed all the number fields into zero's :

You tried to execute a query that does not include the specified expression 'ITEMNO' as part of an aggregate function

This really beats me!
I have a table "IM04_04allYrsPickQTY", 2 text columns 'ITEMNO' and 'KEYWORD' and the following number-columns and I have already changed those blank number fields into zero's :
2008QTY
2008PICKS
2009QTY
2009PICKS
2010QTY
2010PICKS
201104QTY
201104PICKS
Please help.
I have enclosed the copy DB for your convenience.
thanks
karen
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78549
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Adding up expression not working in query ?

Post by HansV »

The Sum function in Access doesn't work across columns (fields) but across rows (records). You want to add some fields within the same row, you can't use Sum for that purpose. You can simply omit it:

3yrsPLUSqty: [2008Qty]+[2009Qty]+[2010Qty]+[201104Qty]

and

3yrsPLUSpicks: [2008Picks]+[2009Picks]+[2010Picks]+[201104Picks]
Best wishes,
Hans

KarenYT
3StarLounger
Posts: 212
Joined: 28 Mar 2011, 18:29
Location: Netherlands

Re: Adding up expression not working in query ?

Post by KarenYT »

You are right ! How can I forget this simple rule, thankyou thankyou! I thought I tried and didn't work out - I must have lost my mind!

I appreciate very much for your help! and your prompt response as always !
Karen