Results 1 to 11 of 11
  1. #1
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    670

    Add Total Field To Report

    I have a report that shows Store Information and items ordered the price of the items and the quantity. I want to add in a calculated field to show the SUM() for each store, so my desired output calculations would be
    Serial 1111 should produce 830.21
    SERIAL 1234 should produce 11.35
    SERIAL 2311 should produce 92.38
    SERIAL 5555 should produce 46.03
    SERIAL 5566 should produce 252.76

    However, when I added in the field, as I thought it should be added, this was not produced. I am attaching a sample of my db with garbage data to better allow someone to troubleshoot. How should I set-up the calculate field to do the calculations like I am after?



    Database2.zip

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    I think you need "OT" in the detail section of the report
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    670
    @Bob Fitz - I am unable to move OT to the detail section of the report as OT need only be displayed once per the Serial which Is why I left in Serial Header.

    If there is better way to set-up this report, I am open to suggestions.

  4. #4
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Would the dsum function be any use here? I can't access your attachment but an example is

    DSum("[Quantity]*[UnitPrice]", "Order Details", _
    "[ProductID] = "& [ProductID])


    Sent from my iPhone using Tapatalk

  5. #5
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    670
    @andy49 - I used the formula you provided as a basis and came up with this as the control source
    Code:
    =DSum("[OT]+[LIT]","Test","[SERIAL] =  &[SERIAL]")
    This produces the sum multiple times, not add a "Grand Total" for each individual Serial

  6. #6
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    670
    I even attempted to add a sub-report to the form, and the sub-report produces a total row for each line item produced.

    Is it possible to have ONLY 1 total row produced?

  7. #7
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Database3.accdb

    not saying its perfect but how's this. I created a User defined function which I used in the _test query. The function is based on the dmax function so I guess that could be used directly as a row source but I couldn't get the format right

  8. #8
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    670
    @andy49 - closer. Thank you for that sample. I am going to continue to toy with the db

  9. #9
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Does the function give the right values jo


    Sent from my iPhone using Tapatalk

  10. #10
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I think there might be a double quote in the wrong place
    Code:
    =DSum("[OT]+[LIT]","Test","[SERIAL] =  & [SERIAL]")
    Try
    Code:
    =DSum("[OT]+[LIT]","Test","[SERIAL] = "  & [SERIAL])


    You might need text delimiters if the field [SERIAL] is a string........

  11. #11
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Perhaps create a new control bound to OT. Hide it and use in the calculation.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 03-06-2016, 04:23 AM
  2. Replies: 3
    Last Post: 04-07-2015, 10:37 AM
  3. Replies: 3
    Last Post: 01-18-2015, 06:05 PM
  4. Setup a field to Total Weight in My Report
    By Triland in forum Access
    Replies: 2
    Last Post: 01-25-2013, 02:11 PM
  5. Replies: 1
    Last Post: 06-29-2010, 03:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums