Results 1 to 11 of 11
  1. #1
    LOIZOS is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2014
    Posts
    17

    Dsum Function

    Hi,
    I try to use Dsum in a Subform and I am Getting Error Message

    My Formula is
    Dsum([GrossTotal];[frm_invoices-heater];[Invoice_Type]="CR")


    I think that my error is on the source part of the formula
    Pls Help

  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,641
    See if this helps:

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

  3. #3
    LOIZOS is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2014
    Posts
    17
    Dear Pbaldy

    I want To sum up the GrossTotal Amount

    Dlookup is not for summation

  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,641
    Did you miss the first line of the link?

    Note that the same logic applies to most Domain Aggregate Functions (DMax, DMin etc.)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Paul knows you're attempting to sum the field! He's trying to tell you that the Aggregate Functions utilize the same syntax as DLookup(), and your syntax is way off of the mark.

    Where you have

    frm_invoices-heater

    you need to have the name of the domain; a domain is Table or Query, not a Form. Also, Aggregate Functions cannot be run against Calculated Fields, and GrossTotal sounds suspiciously like a Calculated Field.

    If, for instance

    GrossTotal = Units * UnitPrice

    Instead of using

    Sum([GrossTotal])

    you have to use

    Sum([Units] * [UnitPrice])

    Linq ;0)>

  6. #6
    LOIZOS is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2014
    Posts
    17
    Thank you for you reply
    I fix my formula and i got the sum of a Gross Total
    Now I want to get the sum for a specific customer and is not working.
    My formula is
    Dsum("Gross_Total";"Invoices-header";"Customer_code=" & [Forms]![Frm-invoices-header]![Customer_code])

    I also try
    Dsum("Gross_Total";"Invoices-header";"Customer_code=" & [Frm-invoices-header].[form]![Customer_code])

    Still not working

    Thanks

  7. #7
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Is Customer_code defined as a Number or as Text? The syntax varies, depending on the Datatype.

    Linq ;0)>

  8. #8
    LOIZOS is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2014
    Posts
    17
    Customer_code is a Text

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    I'd refer you back to the link for the syntax adjustment required for text, but...
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    LOIZOS is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2014
    Posts
    17
    Paul
    pls Complete the formula

    Dsum("Gross_total";"Invoices-header";"Customer_code=

    Customer_code is a text
    the form name is Frm-invoices-heater-data

  11. #11
    LOIZOS is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2014
    Posts
    17
    Paul and Missinglink
    pls Complete the formula

    Dsum("Gross_total";"Invoices-header";"Customer_code=.................

    Customer_code is a text
    the form name is Frm-invoices-heater-data

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

Similar Threads

  1. DSum Function
    By azhar2006 in forum Forms
    Replies: 7
    Last Post: 12-08-2013, 05:07 PM
  2. Dsum() Function
    By rkalapura in forum Queries
    Replies: 2
    Last Post: 10-24-2012, 05:58 PM
  3. Dsum() function
    By rkalapura in forum Forms
    Replies: 3
    Last Post: 10-10-2012, 10:06 PM
  4. Problem in Query and DSUM function
    By simplefahad2005 in forum Access
    Replies: 3
    Last Post: 07-27-2012, 12:46 AM
  5. Help with dsum
    By bjsbrown in forum Reports
    Replies: 6
    Last Post: 02-06-2010, 09:33 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