Variant = Null = not working right!!!

GKite

Registered User.
Local time
Today, 03:20
Joined
Mar 22, 2002
Messages
29
I used the following code to look for a dulicate entry in a table vs a field on a form. Everything seems to work ok, BUT I'm trying to use and IF THEN statement based on the value of a variant, and it doesn't work at all! If the variant = null then the intSkip = 2. If the variant = 'something' then the intSkip = 2. Why is this???

Dim stDocName As String
Dim varDupe As Variant
Dim inSkip As Integer
stDocName = "qryPlaylist_Save"
varDupe = DLookup("[Playlist]", "tblPlayLists", "[Playlist] = [txtPlaylistname]")
If varDupe = Null Then inSkip = 1 Else inSkip = 2
 
Try changing the last statement to :

If Isnull(varDupe)=True then .......
 
You're a Genius!!! Thanks a bunch!

So is this the required method of comparing Null in VBA?
 

Users who are viewing this thread

Back
Top Bottom