Understanding the Null

steve711

Registered User.
Local time
Today, 14:31
Joined
Mar 25, 2004
Messages
166
Hello All,

I have a form that has a text box that if left blank, untouched, should be read as an error to the user.

For example. They must enter a tail number in this block if they entered a flight time for that tail number.

My problem arises when in my code I do this.

If me.txtEcoTime.value > 0 and me.txtEcoStar.value = Null then (slap the user to enter a tail number setting focus to that offending block)

Ok this doesn't work for some reason. I've watched it and Access sees that txtEcoStar = Null but when I do this check it could careless. What am I missing or doing wrong on this one?
 
From the IsNull function description in Access 97 help:

Important: Use the IsNull function to determine whether an expression contains a Null value. Expressions that you might expect to evaluate to True under some circumstances, such as If Var = Null and If Var <> Null, are always False. This is because any expression containing a Null is itself Null and, therefore, False.

So to test for Null, try:

If Me.txtEcoTime > 0 And IsNull(Me.txtEcoStar) Then
ArgueWithUser
End If

hth,

Doug.
 
Thanks

Thank you. That solved that minor headache. I looked in Office XP Access help and was unable to find what you found unless I specifically looked for IsNull. Just Null doesn't do the trick. But anyway.

Thank you again.
 
As you two have figured out, perhaps accidentally, the Access 97 help system is far superior to the Access 2000/20002 (XP) system. It's been discussed on the forums before. I don't know what Microsoft did, but hopefully they fixed 2003.
 
Ah-yup!

'97 & 2000 Helps are different, no doubt...

I dunno... Designing a help for a 'puter has gotta be one of the hardest things there is to do (I usually quit 'bout half way through a help file for a db 'casue I don't know where to stop giving info. to a user...).

All in all, I'd have to say neither '97 or 2000 Help is that bad.

And neither one is that good.

Anyone remember running code & looking up err numbers in (heh, heh...) ring binders?

I do. It's really all the same thing: Ya gotta follow references...

Doug.
 

Users who are viewing this thread

Back
Top Bottom