I have a data entry form. Let's say I have filled up all the required fields in the main and sub form, and then I decide not to save the form. I want to have a button that upon clicking, will discard all the data on the form and not save it in the tables. How do I write the required code? Currently I have thought of this:
However Me.Undo only gets rid of the data entered in the main form before the focus enters the subform. I think Undo is not the way to delete the record in the table. Appreciative of any input. Thanks a lot!
Code:
Dim strMsg As String, strTitle As String
strMsg = "Do You Want to Save This Record?"
strTitle = " Save Record ?"
If MsgBox(strMsg, vbQuestion + vbYesNo, strTitle) = vbNo Then
Me.Undo
End If
DoCmd.GoToRecord , , acLast
However Me.Undo only gets rid of the data entered in the main form before the focus enters the subform. I think Undo is not the way to delete the record in the table. Appreciative of any input. Thanks a lot!