Results 1 to 6 of 6
  1. #1
    mike02 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    245

    Dsum, Syntax error

    Hey, I am trying to run this Dsum function:



    Code:
    RunTot: Format(DSum("[Monthly_Sales].[UnitsSold]","Monthly_Sales","[Monthly_Sales].[CompanyID]='" & [Monthly_Sales].[CompanyID] & "' And [Monthly_Sales].[MonthlyDate] <=#" & [Monthly_Sales].[MonthlyDate] & "#"),"00.00")
    I use to have it set up on text and Date, but i am changing it to Numeric, CompanyID, in stead of CompanyName and Date as well.

    thanks in advance,

  2. #2
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    RunTot: Format(DSum("[Monthly_Sales].[UnitsSold]","Monthly_Sales","[Monthly_Sales].[CompanyID]='" & [Monthly_Sales].[CompanyID] & "' And [Monthly_Sales].[MonthlyDate] <=#" & [Monthly_Sales].[MonthlyDate] & "#"),"00.00")
    I think you need to put something in place of the , (comas) ( + - * / )

    If you are intending on using them as all to get some total.
    I am not sure this will work if you are trying to get a sum for each field.

    Dale

  3. #3
    mike02 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    245
    i need the totals to continue to sum, that way i can create a graph showing the growth

  4. #4
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    i need the totals to continue to sum, that way i can create a graph showing the growth
    Meaning you need individual totals for each field. Correct?

    If so I think it will require a Dsum() function for each field.


    Dale

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    If "CompanyID" is numeric, it doesn't require delimiters. Remove the single quotes for "CompanyID"

    Try this:
    Code:
    RunTot: Format(DSum("[Monthly_Sales].[UnitsSold]","Monthly_Sales","[Monthly_Sales].[CompanyID]=" & [Monthly_Sales].[CompanyID] & " And [Monthly_Sales].[MonthlyDate] <=#" & [Monthly_Sales].[MonthlyDate] & "#"),"00.00")

  6. #6
    mike02 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    245
    thanks! worked!

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

Similar Threads

  1. Replies: 13
    Last Post: 12-05-2011, 05:10 AM
  2. DSUM() Error
    By msr71 in forum Access
    Replies: 14
    Last Post: 09-25-2011, 06:39 PM
  3. DSum syntax for report
    By dwilson in forum Access
    Replies: 2
    Last Post: 09-08-2011, 07:31 PM
  4. DSum Syntax Help
    By desk4tbc in forum Programming
    Replies: 2
    Last Post: 07-01-2011, 02:31 PM
  5. Incomplete Syntax Clause (syntax error)
    By ajetrumpet in forum Programming
    Replies: 4
    Last Post: 09-11-2010, 10:47 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