Search code examples
ms-accessms-access-2016

DSUM - Data Typed Mismatched in Criteria Expression


Withdrawal: DSum("[quantity]","Withdrawal","[part_number]= '&[part_number]&'")

I am getting the above error due to the statement above.

I have an Orders table, would like to collate and display the withdrawals quantity for each part number. Data type is number, am I missing anything here?

Your help is much appreciated.


Solution

  • You're working with 2 types of quotes, and doing it improperly. The proper code should be:

    Withdrawal: DSum("[quantity]","Withdrawal","[part_number]= " & [part_number])
    

    In the code above, the second [part_number] was still inside a string so not filling properly. As a result you were comparing part numbers with the string [part_number]