T
Tony Williams
I have a command button on a form that the user clicks on to close the form
after inputting data. If the record is a new one I want a message box to pop
up that asks them to confirm whether or not they want to save the record.
I'm using this code on the OnClick property
Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click
If Me.NewRecord Then
MsgBox "Are you sure you want to save this new record?"
End If
DoCmd.Close
Exit_cmdClose_Click:
Exit Sub
Err_cmdClose_Click:
MsgBox Err.Description
Resume Exit_cmdClose_Click
End Sub
But it doesn't work can anyone tell me why?
TIA
Tony Williams
after inputting data. If the record is a new one I want a message box to pop
up that asks them to confirm whether or not they want to save the record.
I'm using this code on the OnClick property
Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click
If Me.NewRecord Then
MsgBox "Are you sure you want to save this new record?"
End If
DoCmd.Close
Exit_cmdClose_Click:
Exit Sub
Err_cmdClose_Click:
MsgBox Err.Description
Resume Exit_cmdClose_Click
End Sub
But it doesn't work can anyone tell me why?
TIA
Tony Williams