Reputation: 13
i am working on Access project. Dsum is working fine without Criteria but when i insert criteria. it simply not working.
Me.usd = DSum("[Amount]", "Commission", "Currency= usd")
"me.usd" is TextBox And "Amount" is column and " Commission" is Table "Currency" is where to look for currency type
if i exclude criteria with "" it gives total amount sum but it returns nothing with criteria. can anyone correct where i am wrong.
Upvotes: 1
Views: 269
Reputation: 12353
Strings should be enclosed with single quotes in where clause
Me.usd = DSum("[Amount]", "Commission", "[Currency]= 'usd'")
If the currency field is number use below, no need for quotes. Assuming USD = 1 in your case
Me.usd = DSum("[Amount]", "Commission", "[Currency]= 1")
Upvotes: 1