Record Navigator problem

  • Thread starter Thread starter George Papadopoulos
  • Start date Start date
G

George Papadopoulos

I have this problem! I have a form with certain text boxes on it. The text
boxes are bounded to a table of my database. The record navigator is also
enabled. Some fields of the table are required (have to be input).
The problem is that a user may not input these fields yet press on the
next record button of the navigator. Thus, I get an error.
How can I capture this asynchronous error?
 
Use the BeforeUpdate event of your form to trap the error and generate your
own message if desired.

This kind of thing:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strMsg As String

If IsNull(Me.[SomeField] Then
Cancel = True
strMsg = strMsg & "SomeField required." & vbCrLf
End If

If IsNull(Me.[AnotherField] Then
Cancel = True
strMsg = strMsg & "AnotherField required." & vbCrLf
End If
'etc.

If Cancel Then
strMsg = strMsg & vbCrLf & "Correct the data, or press <Esc> to
undo."
MsgBox strMsg, vbExclamation, "Invalid data"
End If
End Sub
 
Back
Top