Correct syntax for Dlookup

W

Will Sellers

I am trying to get the value of a field in a supplier profile table so that
I can perform actions based on file type. The criteria comes from an open
form
This is my syntax but I can't get it to work

varX = DLookup("[ImportTabFile type]", "supplier profile", "[supplier code]
=" & Forms![select Supplier]!dummy)
 
J

John Vinson

I am trying to get the value of a field in a supplier profile table so that
I can perform actions based on file type. The criteria comes from an open
form
This is my syntax but I can't get it to work

varX = DLookup("[ImportTabFile type]", "supplier profile", "[supplier code]
=" & Forms![select Supplier]!dummy)

If [Supplier Code] is a Text field you need the syntactically required
quote marks. I'd also suggest putting brackets around the table name
since it contains a special character (a blank):

varX = DLookup("[ImportTabFile type]", "[supplier profile]",
"[supplier code]='" & Forms![select Supplier]!dummy & "'")


John W. Vinson[MVP]
 
Top