By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,967 Members | 1,267 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,967 IT Pros & Developers. It's quick & easy.

Confirm record updates dialog

P: n/a
I am using the code below to force a user to confirm changes to a form. This
works fine unless the form has a subform. Here is what happens:

1. If I put the code in the both the main form and the subform, the message
box pops up twice when I update records in the subform.

2. If I only use the code in the main form and make changes in the subform,
even when I click "Cancel" the changes in the subform are still saved.

I have tried using a public boolean variable to help with this, but can't
seem to find the correct event to set the variable's value so as to avoid
scenario 1. above.

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim intSaveChanges As Integer
intSaveChanges = MsgBox("Save Changes?", vbOKCancel)
If intSaveChanges <> vbOK Then
DoCmd.RunCommand acCmdUndo
Cancel = True
End If
End Sub
Feb 15 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.