Horseleach
New member
- Local time
- Today, 07:07
- Joined
- Jan 18, 2008
- Messages
- 3
Forgive me I'm new. I wrote this below. It works great. I have a small problem tho. After selecting No, if "Undo" is unavailable an error message pops up and reads "The command or action 'undo' isn't available now." I designed this for firefighters who get confused really easy when it comes to computers. Is there a way for me to suppress the error and for it to continue closing the form?
---------------------
Private Sub Command169_Click()
Dim strMsg As String
strMsg = "Do you wish to save the changes?"
strMsg = strMsg & vbCrLf & ""
strMsg = strMsg & vbCrLf & "Click Yes to Save"
If MsgBox(strMsg, vbQuestion + vbYesNo, "China Lake Fire Training DB") = vbYes Then
DoCmd.RunCommand acCmdSaveRecord
If Me.Dirty Then Me.Dirty = False
DoCmd.Close
Else
On Error GoTo Err_Command199_Click
DoCmd.RunCommand acCmdUndo
DoCmd.Close acForm, "MainInputAdd", acSaveNo
Exit_Command199_Click:
DoCmd.Close acForm, "MainInputAdd", acSaveNo
Exit Sub
Err_Command199_Click:
MsgBox Err.Description
Resume Exit_Command199_Click
End If
End Sub
---------------------
Private Sub Command169_Click()
Dim strMsg As String
strMsg = "Do you wish to save the changes?"
strMsg = strMsg & vbCrLf & ""
strMsg = strMsg & vbCrLf & "Click Yes to Save"
If MsgBox(strMsg, vbQuestion + vbYesNo, "China Lake Fire Training DB") = vbYes Then
DoCmd.RunCommand acCmdSaveRecord
If Me.Dirty Then Me.Dirty = False
DoCmd.Close
Else
On Error GoTo Err_Command199_Click
DoCmd.RunCommand acCmdUndo
DoCmd.Close acForm, "MainInputAdd", acSaveNo
Exit_Command199_Click:
DoCmd.Close acForm, "MainInputAdd", acSaveNo
Exit Sub
Err_Command199_Click:
MsgBox Err.Description
Resume Exit_Command199_Click
End If
End Sub