No current record error

L

Lori

I have a form that has some required fields. I am using Access 2003. I put
the following code in the form's BeforeUpdate event to send the user an error
message if they try to close the form without entering the required fields.
The problem is that after my error message is displayed, Access sends another
error message saying "No current record". I get this message when adding a
new record without all of the required fields entered. Any ideas? Thanks!

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

If IsNull(Me.Non_Vendor_Name) Then
strMsg = strMsg & "Please enter a Name." & vbCrLf
Cancel = True
End If

If IsNull(Me.Address_Line_One) Then
strMsg = strMsg & "Please enter Line One of the Address." & vbCrLf
Cancel = True
End If

If strMsg <> vbNullString Then
MsgBox strMsg, vbExclamation, "Missing Required Fields"
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

Similar Threads


Top