A
abrown
Greetings!
I have a form where users can search requests, as well as add new requests
bu clicking the "Add New Request" button. However, if the user decides not to
save the new request by clicking the "Save" button and wants to cancel by
clicking the "Main Menu" button, the request is still saved in the table. How
can I get this data to be deleted from the table?
Keep in mind that if the user is searching through the requests and clicks
the "Main Menu" button I don't want that data deleted...only when there is
being a new request entered and the user wants to cancel that new request.
Here is the code I currently have, which is not working properly.
Private Sub btnMainMenu_Click()
Dim saveRecord As Integer
saveRecord = MsgBox("Do you want to save your changes?", vbYesNo, "Save
Changes")
If saveRecord = vbYes Then
Me.btnSave.SetFocus
Else
MsgBox ("These changes have not been saved.")
DoCmd.CancelEvent
Me.Undo
DoCmd.Close
End If
End Sub
I have a form where users can search requests, as well as add new requests
bu clicking the "Add New Request" button. However, if the user decides not to
save the new request by clicking the "Save" button and wants to cancel by
clicking the "Main Menu" button, the request is still saved in the table. How
can I get this data to be deleted from the table?
Keep in mind that if the user is searching through the requests and clicks
the "Main Menu" button I don't want that data deleted...only when there is
being a new request entered and the user wants to cancel that new request.
Here is the code I currently have, which is not working properly.
Private Sub btnMainMenu_Click()
Dim saveRecord As Integer
saveRecord = MsgBox("Do you want to save your changes?", vbYesNo, "Save
Changes")
If saveRecord = vbYes Then
Me.btnSave.SetFocus
Else
MsgBox ("These changes have not been saved.")
DoCmd.CancelEvent
Me.Undo
DoCmd.Close
End If
End Sub