Stay in same record on errors

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a continious form where I check the users input when then enter a
record. If the input is not valid I display a message telling them what is
wrong. My problem is that I want the cursor to remain in the same record
after displaying the error. Right now, if they enter a record and then click
on a differrent record the message displays, but the cursor goes to the
record they clicked on. How do I prevent the user from exiting the current
record?

Thanks
 
Use the BeforeUpdate event procedure of the *form* to validate the record,
and cancel the event if the entry is not acceptable.

Example:

Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.Surname) Then
Cancel = True
MsgBox "Fill in the Surname, or press <Esc> to undo."
End If
End Sub
 
Back
Top