View Full Version : Search for a Number


Djblois
03-13-2009, 08:08 AM
I use these code that works perfectly to search for Text:

DoCmd.OpenForm "frmOpenDetails", , , "Appt_Id = " & _
DLookup("[Appt_id]", "Outgoing_Orders_Table", "[REF] = '" & Me.tbSearch.Value & "'")

I know in order to search a Number Field I need to change it but I can't get it working. Here is what I tried:

DoCmd.OpenForm "frmOpenDetails", , , "Appt_Id = " & _
DLookup("[Appt_id]", "Scheduled_Appts", [Confirmation_Num] = Me.tbSearch.Value)

pbaldy
03-13-2009, 08:13 AM
You still need to concatenate the form reference, you just don't want the single quotes around it (and you still need quotes around the criteria):

DLookup("[Appt_id]", "Scheduled_Appts", "[Confirmation_Num] = " & Me.tbSearch.Value)

boblarson
03-13-2009, 08:14 AM
DoCmd.OpenForm "frmOpenDetails", , , "Appt_Id = " & _
DLookup("[Appt_id]", "Scheduled_Appts", "[Confirmation_Num] = " & Me.tbSearch.Value)

jal
03-13-2009, 08:14 AM
Maybe this:

DLookup("[Appt_id]", "Scheduled_Appts", "[Confirmation_Num] = " & Me.tbSearch.Value)

jal
03-13-2009, 08:15 AM
Ok, looks like everyone beat me to the punch.

boblarson
03-13-2009, 08:16 AM
Ok, looks like everyone beat me to the punch.

Hey - the more, the merrier! :D