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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help to build simple error message

Status
Not open for further replies.

upplepop

IS-IT--Management
Jun 1, 2002
173
US
I have a form with several Tabs. On the last tab (page4) I want a routine that will give an error message if a Text Box on the first tab (page1) is null and set the focus on that text box. This is what I have so far, but it's not working:

Private Sub txtClosed_GotFocus()
If txtDOB.Text Is Null Then MsgBox("Need date of birth") As VbMsgBoxResult
End Sub

Can anyone help?
 
I tried using that, but I get a error:

Run-Time error '424': object required

Here's what I used:

Private Sub txtClosed_GotFocus()
If Me.txtDOB Is Null Then
MsgBox "Enter DOB", vbExclamation
End If
End Sub


What's wrong???
 
Hi,

I think your problem may be with the "Is Null" part of your routine. The syntax IsNull([what you're checking]) should work.

so yours would go like...

If IsNull(Me.txtDOB) Then
MsgBox "Enter DOB", vbExclamation
End If

Hope this helps out,
CJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top