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
 
Back
Top