Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2011
    Posts
    7

    Unanswered: 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?

  2. #2
    Join Date
    Mar 2009
    Location
    Dorset
    Posts
    119
    Where is the textbox?
    Try summing the price and quantity together in your footer. Something like this:

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

    Software-Matters

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    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 problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    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!

  5. #5
    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!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •