DLookup syntax (1 Viewer)

Ben_Entrew

Registered User.
Local time
Today, 11:11
Joined
Dec 3, 2013
Messages
177
Hi all,

can somebody please help me?

Something is wrong with this dlookup in :

Code:
strSQL = "Update TNS Set TNS_in_TRY = " & _
           " Nz([TNS_in_TRY],0) + " & Str(a) & " * Dlookup([TNS_in_TRY],TNS,Division = 'COMMON' AND Product_Class = 'Scrap_Sales' AND Reporting_Month = '" & t & "') " &
           " Where Division IN ('AK') AND Product_Class = 'Scrap Sales' AND Reporting_Month = '" & t & "'"


I debugged a and t these variables are correct.
Thanks in advance.

Regards,

Ben
 

Cronk

Registered User.
Local time
Tomorrow, 04:11
Joined
Jul 4, 2013
Messages
2,772
Have you tried pasting the rSQL string in the sql for a query and look at the design window?
 

namliam

The Mailman - AWF VIP
Local time
Today, 20:11
Joined
Aug 11, 2003
Messages
11,695
I am guessing the missing _ on the end of the second line?
 

pr2-eugin

Super Moderator
Local time
Today, 19:11
Joined
Nov 30, 2011
Messages
8,494
Ben_Entrew, Divide and Conquer. Take the DLookup out of the UPDATE statement, give it to a variable.
 

Users who are viewing this thread

Top Bottom