Help with MsgBox and If Then Statement

dzirkelb

Registered User.
Local time
Today, 13:02
Joined
Jan 14, 2005
Messages
180
I wish to have a msg box pop up to the user if my text box is null, and hten cancel the update...else, have it run as normal. here is my current code:

Code:
If Me.txtStoreID = Null Then
MsgBox ("Hey")
Cancel = True

End If

It updates the record if txtStoreID is null, and it isn't popping up a msg box.  If, however, I change it to say, me.txtStoreID=0 and I put store id to 0, then the box works...what am I doing wrong with the null value?  Thanks!
 
If IsNull(Me.MyTextBox) Then
 
That did the trick..thanks a ton!
 
Do not forget about those pesky empty strings. i.e. A user starts typing something in a text box then they use the delete key or backspace key to clear it so that it looks empty but it is no longer Null.

If IsNull([MyTextBox]) or [MyTextBox] = "" Then
 

Users who are viewing this thread

Back
Top Bottom