Dual Error messages

G

Guest

Hi and Thanks! I have a field (MemberDate) on a form that I want to have
completed, but is not a required field in the table.

There is a coded error message:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim iAns As Integer
If Member = True And IsNull(Me!MemberDate) Then
iAns = MsgBox("Please enter a Member 'Since' Date to continue, or click
Cancel to erase this record", vbOKCancel)
If iAns = vbOK Then
Cancel = True
Me!MemberDate.SetFocus
Else
Cancel = True
Me.Undo ' erase the entire form
End If
End If
End Sub

Which pops up the message box just right.

Then immediately following, Access gets in on it with its own message box:
“You can’t save this record at this time. Access may have encountered an
error while trying to save a record. If you close the object now, the data
changes you made will be lost. Do you want to close the database object
anyway?â€

If I click “no†I can complete MemberDate no problem. How can I make
Access’ message go away?
 
G

G. Vaught

Try removing the Cancel = True if the user wants to enter a date. You should
only need to set the focus back to the record as you still want to save this
record.
 

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