Record Navigator problem

  • Thread starter George Papadopoulos
  • 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?
 
A

Allen Browne

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
 

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

Top