Struggling with Dsum

tucker61

Registered User.
Local time
Today, 02:55
Joined
Jan 13, 2008
Messages
344
I need to add additional criteria to my Code below

Code:
=Nz(DSum("Qty","tblunpickable_data", "Option='" & [tbOption] & "'  "),"")

the additional field i need to add is Status <> "PK" but when i have amended and i now get the #Name? error.

Code:
=DSum("Qty","tblunpickable_data","option='" & [tbOption] & "' And [Status]='" & [PK] & "'")

any help appreciated.
 
I need to add additional criteria to my Code below

Code:
=Nz(DSum("Qty","tblunpickable_data", "Option='" & [tbOption] & "'  "),"")

the additional field i need to add is Status <> "PK" but when i have amended and i now get the #Name? error.

Code:
=DSum("Qty","tblunpickable_data","option='" & [tbOption] & "' And [Status]='" & [PK] & "'")

any help appreciated.

Equal to or not equal to ....?

If you want Status <> "PK" then
Code:
=DSum("Qty","tblunpickable_data","option='" & [tbOption] & "' And [Status]<>'PK'")

For Status = PK then
Code:
=DSum("Qty","tblunpickable_data","option='" & [tbOption] & "' And [Status]='PK'")
 
if you are running DSUM in a form:
the variable must look at the name of the text box (or combo or other control)
NOT the field name. Brackets are for queries to determine field names...
[Status], or [tbOption]
Do not use brackets for control names.

=DSum("Qty","tblunpickable_data","option='" & me.txtOption & "' And [Status]='" & me.txtPK & "'")
 
Equal to or not equal to ....?

If you want Status <> "PK" then
Code:
=DSum("Qty","tblunpickable_data","option='" & [tbOption] & "' And [Status]<>'PK'")

For Status = PK then
Code:
=DSum("Qty","tblunpickable_data","option='" & [tbOption] & "' And [Status]='PK'")



Thanks mate this worked.. I always struggle with the apostrophe and the speech marks..
 

Users who are viewing this thread

Back
Top Bottom