am using the following script in the BeforeUpdate area of a main form.
Private Sub Form_BeforeUpda te(Cancel As Integer)
Dim strMsg As String
strMsg = "Do you wish to save your changes?"
If MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?") = vbYes
Then
'do nothing
Else
On Error Resume Next
Application.Ech o (False)
Me!sfrmAddress. SetFocus
DoCmd.RunComman d (acCmdUndo)
Application.Ech o (True)
'Me!RolodexNew. SetFocus
'DoCmd.RunComma nd (acCmdUndo)
End If
End Sub
The script works great but it's very repetitive. In the main form I
have include two sub-forms. Everytime the user switches between forms
the script prompts them to save. Which works. I am no sure if I need
to just move the script into a different Event or not.
What I would like to do is for a user to make all the edits they need
in the main form including all the sub-forms and when they move to a
new record or leave the main form it prompts/saves the changes to main
form and sub-forms. As you can see, if they cancel the save, it undoes
all their changes prior to the save. Is that function still possible
while moving through sub-forms. So, if they make changes in both
sub-forms and then decide they don't want them, is their a script that
will allow me to undo all entries?
Thanks...any help would be appreciated.