Ahmar
Ahmar

Reputation: 13

Microsoft Access Dsum Single Criteria Not Working

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

Answers (1)

Santosh
Santosh

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

Related Questions