If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Problems with Summing

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-21-11, 01:56
beanhead0321 beanhead0321 is offline
Registered User
 
Join Date: Jul 2011
Posts: 7
Problems with Summing

Hi All,

I'm having trouble summing a list in my report. I have a field called "TotalCost" which is a product of "price" and "Quantity" both of which are also on the report. I have a textbox in my footer of my report with the following in the control source:
Code:
=Sum([TotalCost])
When I run the report, the textbox says #error. I have also tried pulling the info from the query the report is made from using:
Code:
=Sum([TakeOutQuery]![TotalCost])
but that returns the same thing.

I have a running total at the bottom of my query table. Is there anyway I can just pull that over? What am I doing wrong with my code?
Reply With Quote
  #2 (permalink)  
Old 07-21-11, 12:25
SoftwareMatters SoftwareMatters is offline
Registered User
 
Join Date: Mar 2009
Location: Dorset
Posts: 78
Where is the textbox?
Try summing the price and quantity together in your footer. Something like this:

=Sum([Price]*[Qty])
__________________
Regards
JD

Bespoke Access Database Design and Development Services
Software Matters - Simple Solutions That Work!
Reply With Quote
  #3 (permalink)  
Old 07-21-11, 17:25
Missinglinq Missinglinq is offline
Registered User
 
Join Date: Jun 2005
Location: Richmond, Virginia USA
Posts: 1,702
JD has the right idea, you cannot run Aggregate Functions against calculated fields, you have too run them against the Expression used for the calculation.

Linq ;0)>
__________________
Hope this helps!

The Devil's in the Details!!

All posts/responses based on Access 2000/2003
Reply With Quote
  #4 (permalink)  
Old 07-21-11, 20:17
beanhead0321 beanhead0321 is offline
Registered User
 
Join Date: Jul 2011
Posts: 7
I figured it out guys. Thanks for the help. I had the textbox in the page footer instead of the report footer. I have another issue now.

I want to run a query based on a combo box (Combo2) whose options are based on a query ran on another combo box (Combo1).
When I enter the criteria for my query based on the selection of combo2 as [forms]![takeoutform]![combo2], nothing shows up... Granted I have 4 columns in combo2, three of which are hidden. Do I need to specify which column I want my query to look up to match the criteria? If so, how do I go about doing that in SQL? I can do it in vb, but that doesn't help. Is it not okay to create a query from a query?

The final goal is to have a form which two combo boxes, one based on the other and a textbox. The textbox will equal the difference between the sums of a column in two different tables. Basically it is for calculating the amount of inventory left by taking the sum of the a specific product bought minus the sum of that product used. The specific product is based on the two combo boxes, one is the name (combo1) and the other is the model number (combo2).

Thanks for all the help guys!
Reply With Quote
  #5 (permalink)  
Old 07-21-11, 20:21
beanhead0321 beanhead0321 is offline
Registered User
 
Join Date: Jul 2011
Posts: 7
Talking

Nvm guys, I got that to work too. XD Thanks for all the help! This forum is wonderful! People are really smart and awesome!
Reply With Quote
Reply

Tags
error, query, report, sum

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On