Dlookup error...Aghhhh

davebhoy

Dave
Local time
Today, 05:47
Joined
Aug 1, 2006
Messages
37
Hi there

Can someone please help me with this, I'm using the following code to update a textbox on exiting a separate textbox. Aghhhh!

Private Sub user_Exit(Cancel As Integer)
Dim clt As Variant

clt = DLookup("client", "users", "user_id = user")

Me.client.ControlSource = "clt"

End Sub
 
Try the following:-

clt = DLookup("[client]", "users", "[user_id]='" & user & "'")

Me.client = clt
 
Thank you so much, that worked.

I never would have figured out all the adverted commas in the criteria, will I come across that in other functions? Thanks again.
 
You will come across it when writing SQL strings, Dcount, Dmin, Dmax. Note you only use the adverted commas in the criteria when the field is text, for numeric fields you omit them.
 

Users who are viewing this thread

Back
Top Bottom