Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to test for empty textbox 1

Status
Not open for further replies.

srast

MIS
Nov 11, 2002
42
US
Hello all;
I have a form (in Access 2000) where the user should enter a date. I need to ensure the user didn't leave the box empty. I did a Degug.print on this control when it is empty, and it returns Null. Yet, when I do If Me.shipDate = Null Then ..., it doesn't execute the Then part, meaning, it is returning false for the if test. Why? And how can I successfully test for an empty textbox?
Any help would be greatly appreciated.
Steve
 
In the BeforeUpdate event of the text box, add this code (I believe your syntax was incorrect).

Private Sub Text0_BeforeUpdate(Cancel As Integer)

If (IsNull(Text0)) Then
MsgBox "Null"
Cancel = True
End IF

End Sub
 
FancyPrarie:
Thanks! Your syntax is correct. (I should have known that one.)
I appreciate the help!
Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top