Help with dlookup syntax needed

hardrock

Registered User.
Local time
Today, 21:19
Joined
Apr 5, 2007
Messages
166
Hi all, txthours is a textbox on my form, but i can't get the dlookup syntax to work... theres a syntax problem i think in the line of code? I get the values for aserial and ahour from a query.. this works ok. any ideas?? thanks



Dim ahour As String
Dim acomment As String
Dim aserial As String

acomment = DLookup("comment", "partfind")
aserial = DLookup("serial", "partfind")
ahour = DLookup("hour", "partfind")

txthours = DLookup("['" & ahour & "']", "RECORDS", "['" & aserial & "']='" & Me.Serialbox & "'")
 
re:

It doesn't help mate sorry.. Dlookup syntax can get real messy at times. I hope someone can spot the problem.
 
I am having difficulty understanding what you are trying to accomplish here:
txthours = DLookup("['" & ahour & "']", "RECORDS", "['" & aserial & "']='" & Me.Serialbox & "'")
Is the value now in the ahour string variable the name of a field in the RECORDS table? Is the same true for the value in the aserial string variable? Is the "aserial" field a string field? Would it be fair to say that you are looking up the field names in the "partfind" table for fields in the RECORDS table? Have you tried:
Code:
txthours = DLookup("[" & ahour & "]", _
   "RECORDS", "[" & aserial & "]='" & Me.Serialbox & "'")
 
re:

Rural guy, that was exactly what i needed. thankyou
 

Users who are viewing this thread

Back
Top Bottom