Need help with DLookup function

BJS

Registered User.
Local time
Today, 17:49
Joined
Aug 29, 2002
Messages
109
Can someone please help me with this...I am spending too much time on this simple thing:

I have a DLookup Function that I need to make work using values from text boxes on my form instead of the actual values.

This works:

x = DLookup("[Index]", "[tblMain]", "[LastDayWorked] = #12/03/2004# AND [SIN] = '123456789'")

Now, I need to replace the values #12/03/2004# with Me.LastDayWorked and 123456789 with Me.SIN

Here is how I did it, but I am getting a type mismatch error...it must have something to do with the quotes or brackets???:

x = DLookup("[Index]", "[tblMain]", "[LastDayWorked] = " & Me.LastDayWorked & "AND [SIN] = " & Me.sin)

THANKS IN ADVANCE FOR THE HELP!
 
x = DLookup("[Index]", "[tblMain]", "[LastDayWorked] = #" & Me.LastDayWorked & "# AND [SIN] = '" & Me.sin & "'")
 
THANK YOU EMP! It worked....You are the best!!
 

Users who are viewing this thread

Back
Top Bottom