Hi,
I have a form and if the user makes changes to a record I use the BeforeUpdate event of the form to ensure they wish to save these changes before moving to a new record.
That works just fine. Now, I also have a button on the form which allows the user to explicitly save the record.
However if I click the save button the prompt from the msgbox in the forms BeforeUpdate event is displayed also. Is there any way I can stop this i.e. cancel the BeforeUpdate for the form when the save button is used.
Thanks,
Liam
I have a form and if the user makes changes to a record I use the BeforeUpdate event of the form to ensure they wish to save these changes before moving to a new record.
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If MsgBox("Data in the current record has been changed since the last save" & Chr(13) & _
"Do you wish to save these changes?", vbYesNo, "Rural Blocks") = 7 Then
Me.Undo
End If
End Sub
That works just fine. Now, I also have a button on the form which allows the user to explicitly save the record.
Code:
Private Sub cmdSave_Click()
DoCmd.RunCommand acCmdSaveRecord
End Sub
However if I click the save button the prompt from the msgbox in the forms BeforeUpdate event is displayed also. Is there any way I can stop this i.e. cancel the BeforeUpdate for the form when the save button is used.
Thanks,
Liam