Solved Need Help Ms access with Dsum

theinviter

Registered User.
Local time
, 20:27
Joined
Aug 14, 2014
Messages
273
Dear Guys
need help with D sum function.

I have a query and added extra field where i want to get the sum based on 2 text criteria (item code and company name)
i tried this :
DSum("[Link Value]","MRN","[Item Code]like""" & [Forms]![MRN Query]![Item_Code] & """ AND [Account Name] like """ & [Forms]![MRN Query]![Account_Name] & """")
but did get any result just got this number "4502" in all column.

so any help
 

Attachments

Instead of saving ItemCode and Clinic into MRN should be saving ID from Combine.

Strongly advise not to use spaces nor punctuation/special characters in naming convention.

Why are you including Combine in form RecordSource?

LIKE without wildcard can just be = sign.

Can use apostrophe instead of doubled quote marks.

Can't use Me. in textbox expressions. Me. is used only in VBA.

=DSum("[Link Value]","MRN","[Item Code]='" & [Item_Code] & "' AND [Account Name] = '" & [Account_Name] & "'")

In query:

Expr1: DSum("[Link Value]","MRN","[Item Code]='" & [MRN].[Item Code] & "' AND [Account Name] like '" & [MRN].[Account Name] & "'")
 
Last edited:
Instead of saving ItemCode and Clinic into MRN should be saving ID from Combine.

Strongly advise not to use spaces nor punctuation/special characters in naming convention.

Why are you including Combine in form RecordSource?

LIKE without wildcard can just be = sign.

Can use apostrophe instead of doubled quote marks.

Can't use Me. in textbox expressions. Me. is used only in VBA.

=DSum("[Link Value]","MRN","[Item Code]='" & [Item_Code] & "' AND [Account Name] = '" & [Account_Name] & "'")

In query:

Expr1: DSum("[Link Value]","MRN","[Item Code]='" & [MRN].[Item Code] & "' AND [Account Name] like '" & [MRN].[Account Name] & "'")
thank for help.
can you please do the change in attached file, i tried but could not solve it.
 
Simple change. Open query and copy/paste my suggested expression. Same for textbox on form.
 

Users who are viewing this thread

Back
Top Bottom