Results 1 to 9 of 9
  1. #1
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129

    DSum ! I jumped the Gun

    my earlier post where I had a problem totalling fields on a report I thought the DSum had fixed this


    using the =DSum("[SourceVol]","[tblDelMain]") in an unbound control on the report sums all [SourceVol] in the DB
    My Report is opened by using two unbound cbo =[Forms]![frmReports]![txtStartDate] and =[Forms]![frmReports]![txtEndDate] via VBAI'm picking I need to either include the DSum in my VBA or in the query for the report to Sum only those records in the report but I cannot get them to work
    help again please

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    How about this in the report footer

    =Sum(SourceVol)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129
    That was my first attempt. The main form has SourceVol as a control with one entry the subform has SupplyVol as control with multiple entries(typ. 1-4 entries). So the report adds one sourcevol amnt for every supplyvol entry
    Explanation: SourceVol is a pick up of goods and SupplyVolis thedelivery of goods
    So Sum(SourceVol) gives a totally inflatedno. but DSum gives the correct total for all records not the screened records. I am using an Allen Brownecode for screening start enddate and cbo record. Have tried to write dsum with criteria into the vba and also into the query but withno joy
    Thanks

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Then you can add a criteria to your DSum:

    DLookup Usage Samples
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129
    This is what I came up with but it returns an #error
    =DSum("[SourceVol]","tblMain","[DelDate] Between #" & [Forms]![frmReports]![txtStartDate] & "# And #" & [Forms]![frmReports]![txtEndDate] & "#")
    This I entered into the control source of an unbound control in the Report Footer
    I have added a zip that has had some notes highlighted if some could see what is happening here I would be grateful
    Thanks

    Attachment 6608

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Have you tried with the correct table name?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129
    ooPS!
    talk about the forest from the trees


  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Brain cramps...we all get them.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129

    Solved

    I used to do building (houses not DBs) Golden rule, if a plan, when a plan is superseded you file the old one away where no one can get to it. So when you change a tbl name I guess you get rid of any old notes
    Thanks again

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

Similar Threads

  1. Help with Sum and DSum
    By objNoob in forum Reports
    Replies: 5
    Last Post: 12-05-2011, 01:55 AM
  2. Problems with DSum
    By Jackie in forum Access
    Replies: 1
    Last Post: 03-27-2011, 05:21 PM
  3. How do I use the DSum
    By Ironclaw in forum Access
    Replies: 1
    Last Post: 08-25-2010, 07:35 AM
  4. Help with dsum
    By bjsbrown in forum Reports
    Replies: 6
    Last Post: 02-06-2010, 09:33 AM
  5. DSUM Problems
    By swampdonkey in forum Forms
    Replies: 2
    Last Post: 09-29-2006, 10:52 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