Error message on required field

  • Thread starter Thread starter Annelie
  • Start date Start date
A

Annelie

The user selects new record and clicks into a required field, but then
changes his mind. There come the endless error messages and only after
clicking the x, eventually it will say: the record cannot be saved at this
time and the form closes.

Is there a graceful way of handling this?

Annelie
 
Is there a graceful way of handling this?

The simplest way is to train the user to hit the <Esc> key twice (once
to cancel the entry in the current control, a second time to cancel
the record being entered) when they wish to cancel.
 
That works. But is there an undo event with a message that could handle this
situation?
Annelie
 
That works. But is there an undo event with a message that could handle this
situation?

Actually, yes, though it's a bit obscure. If you want to have a Cancel
button on the form to do this, it could have the code:

Private Sub cmdCancel_Click()
Dim iAns As Integer
iAns = MsgBox("Cancel this record?", vbYesNo)
If iAns = vbYes Then
Me.Undo
End If
End Sub
 
Just what I was looking for, thanks,
annelie

John Vinson said:
Actually, yes, though it's a bit obscure. If you want to have a Cancel
button on the form to do this, it could have the code:

Private Sub cmdCancel_Click()
Dim iAns As Integer
iAns = MsgBox("Cancel this record?", vbYesNo)
If iAns = vbYes Then
Me.Undo
End If
End Sub
 
Back
Top