Solved Dlookup still showing #error on new record line (1 Viewer)

sspreyer

Registered User.
Local time
Today, 11:06
Joined
Nov 18, 2013
Messages
251
Hi ,
cant work out why #error is still showing on new record line i thought Nz() would supress it ?

Code:
=Nz(DLookUp("sumoftotal","[Query1]","[CV_Order_ID_TXT] = " & [Forms]![Manual_Order_FRM]![CV_Order_ID_TXT]),0)

thanks in advance

shane
 

theDBguy

I’m here to help
Staff member
Local time
Today, 11:06
Joined
Oct 29, 2018
Messages
21,473
Hmm, try adding one more Nz(), just in case.
Rich (BB code):
=Nz(DLookUp("sumoftotal","[Query1]","[CV_Order_ID_TXT] = " & Nz([Forms]![Manual_Order_FRM]![CV_Order_ID_TXT],0)),0)
Hope that helps...
 

plog

Banishment Pending
Local time
Today, 13:06
Joined
May 11, 2011
Messages
11,646
With a name like [CV_Order_ID_TXT] I am guessing the datatype is not a number but text. When you build criteria strings that themselves contain a string you must escape around it by using single quotes:

....,"[CV_Order_ID_TXT] = '" & [Forms]![Manual_Order_FRM]![CV_Order_ID_TXT] & "'"),0)

Its hard for a human eye to see, but I put single quotes inside the double quotes before and after inserting the variable into the criteria sring.
 

sspreyer

Registered User.
Local time
Today, 11:06
Joined
Nov 18, 2013
Messages
251
Hmm, try adding one more Nz(), just in case.
Rich (BB code):
=Nz(DLookUp("sumoftotal","[Query1]","[CV_Order_ID_TXT] = " & Nz([Forms]![Manual_Order_FRM]![CV_Order_ID_TXT],0)),0)
Hope that helps...
spot on !! thank you
 

sspreyer

Registered User.
Local time
Today, 11:06
Joined
Nov 18, 2013
Messages
251
With a name like [CV_Order_ID_TXT] I am guessing the datatype is not a number but text. When you build criteria strings that themselves contain a string you must escape around it by using single quotes:

....,"[CV_Order_ID_TXT] = '" & [Forms]![Manual_Order_FRM]![CV_Order_ID_TXT] & "'"),0)

Its hard for a human eye to see, but I put single quotes inside the double quotes before and after inserting the variable into the criteria sring.
no its a number field txt is just referance for the text box
 

Users who are viewing this thread

Top Bottom