data validation in data form controls

  • Thread starter Thread starter dan
  • Start date Start date
D

dan

I am still struggling with data validation at the control
level when adding new data to a form. Following up on an
earlier thread, I am using the BeforeUpdate property with
the following code (almost straight out of the book):

Private Sub PatientFName_BeforeUpdate(Cancel As Integer)
If PatientFName = "" Then
MsgBox "First Name cannot be blank"
Me!PatientFName.Undo
Cancel = True
End If
End Sub

However you can still tab or click out of the control
without triggering the error statement. What am I doing
wrong.

dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top