Hi everybody,
I'm using Access 2003 and I have a form that has a custom cmdClose button. When pressed, a message box appears asking if the user wants to go back to a previous form.
The problem is that if the user has typed in anything, the record is getting saved and I'm trying to avoid that, if possible.
Here's my code:
Am I missing something or is this possible?
Thanks...
I'm using Access 2003 and I have a form that has a custom cmdClose button. When pressed, a message box appears asking if the user wants to go back to a previous form.
The problem is that if the user has typed in anything, the record is getting saved and I'm trying to avoid that, if possible.
Here's my code:
Code:
Private Sub cmdCancel_Click()
Dim canVal As Integer
canVal = MsgBox("Would you like to begin a new assessment?", vbYesNoCancel + vbQuestion)
If canVal = vbCancel Then
DoCmd.CancelEvent
ElseIf canVal = vbNo Then
MsgBox "You will now be returned to the Main screen", vbOKOnly + vbExclamation
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "Switchboard", acNormal
ElseIf canVal = vbYes Then
If (Me.Dirty = True) Then
Me.Undo
End If
DoCmd.OpenForm "Switchboard", acNormal
DoCmd.Close acForm, Me.Name
End If
End Sub
Thanks...
Comment