DSum (1 Viewer)

VSolano

Registered User.
Local time
Today, 12:40
Joined
Feb 21, 2017
Messages
85
Hello:

I new to the database and I am trying to build a query and I can not get this function to work. I will appreciate any help on this function.

DSumAmt: DSum("[deductionamount]","tbpayrolldeduction","[employeeID]=" & [tbpayrolldeduction]![EmployeeID] And "[BenefitsID] =" & [tbBenefits]![BenefitsID])
 

Beetle

Duly Registered Boozer
Local time
Today, 10:40
Joined
Apr 30, 2011
Messages
1,808
If the data types of EmployeeID and BenefitsID are numeric, then;

Code:
DSumAmt: DSum("[deductionamount]","tbpayrolldeduction","[employeeID]=" & [tbpayrolldeduction]![EmployeeID] & " And [BenefitsID] =" & [tbBenefits]![BenefitsID])

If the data types are text, then;

Code:
DSumAmt: DSum("[deductionamount]","tbpayrolldeduction","[employeeID]=[COLOR="Red"]'[/COLOR]" & [tbpayrolldeduction]![EmployeeID] & "[COLOR="red"]'[/COLOR] And [BenefitsID] =[COLOR="Red"]'[/COLOR]" & [tbBenefits]![BenefitsID] & "[COLOR="red"]'[/COLOR]")

Note the single quote delimiters that are added (highlighted in red)
 

VSolano

Registered User.
Local time
Today, 12:40
Joined
Feb 21, 2017
Messages
85
Thanks for your precise response.
 

Users who are viewing this thread

Top Bottom