Dlookup for a number field

cocowomble

Registered User.
Local time
Today, 03:44
Joined
May 25, 2014
Messages
25
hi all.

I have a code that works fine if the field in the table is a short txt field, however I need the field to be a number field, and therefore the code doesn't work.

the code I'm using is

If Not IsNull(DLookup("[SquadNumber]", "tblPlayers", "[Squadnumber] = '" & Me!SquadNumber & "'")) Then........

guess i'm missing something really basic, but don't know what????



thanks for your help
 
yes really basic - when looking for text, you use the single quotes, when looking for a number, you don't

If Not IsNull(DLookup("[SquadNumber]", "tblPlayers", "[Squadnumber] = " & Me!SquadNumber)) Then........
 
For numbers you don't want the single quotes try:


If Not IsNull(DLookup("[SquadNumber]", "tblPlayers", "[Squadnumber] = " & Me!SquadNumber )) Then........
 

Users who are viewing this thread

Back
Top Bottom