Results 1 to 10 of 10
  1. #1
    Ihthisham is offline Novice
    Windows 10 Office 365
    Join Date
    Jul 2021
    Posts
    10

    Dsum

    Balance: (SELECT SUM([Invoice Amount]-[Payment Amount])
    FROM
    Invoice_Payment WHERE
    Invoice_Payment.Customer ID<='001')




    Table Name is Invoice_payment



    Its says syntax error while running

    Explain the wrong syntax pls

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,537
    Where are you trying to use this expression
    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
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,791
    Agree - usage not clear.
    If you use an aggregate function in sql, you have to give the result an alias name. If that is what you have in sql view, then add an alias - e.g.
    SELECT SUM([Invoice Amount]-[Payment Amount]) AS Balance
    FROM...
    Last edited by Micron; 07-11-2021 at 08:51 AM.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    Think this is in a query view. Looks to me like there is a space before ID

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,899
    Try:

    Invoice_Payment.[Customer ID]

    Best to avoid spaces and punctuation/special characters in naming convention.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    Ihthisham is offline Novice
    Windows 10 Office 365
    Join Date
    Jul 2021
    Posts
    10
    Thank You ,
    Best Regards

  7. #7
    Ihthisham is offline Novice
    Windows 10 Office 365
    Join Date
    Jul 2021
    Posts
    10
    Yes Correct,
    Thank for the Advice

  8. #8
    Ihthisham is offline Novice
    Windows 10 Office 365
    Join Date
    Jul 2021
    Posts
    10
    Yes You are correct
    Tks for the Advice

  9. #9
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    I would hope CustomerID would also be numeric?, so no ' around the value?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  10. #10
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    The id example is ‘001’ so the preceding zeros make it text - unless there is table formatting or lookups being used

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

Similar Threads

  1. DSum
    By GuyfromDet in forum Access
    Replies: 1
    Last Post: 02-24-2017, 11:43 AM
  2. DSum
    By balajigade in forum Queries
    Replies: 1
    Last Post: 04-26-2015, 10:26 AM
  3. Sum or Dsum or........VBA
    By BLFOSTER in forum Programming
    Replies: 7
    Last Post: 04-28-2014, 03:53 PM
  4. Dsum Help?
    By Ragin_roider in forum Queries
    Replies: 5
    Last Post: 03-19-2012, 03:10 PM
  5. How do I use the DSum
    By Ironclaw in forum Access
    Replies: 1
    Last Post: 08-25-2010, 07:35 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