Hi

sarab565

Registered User.
Local time
Today, 05:21
Joined
Dec 31, 2007
Messages
20
i'm trying to find a code to prevent a form changes

i mean

if i chang any thing in the record form and i try to move to another record or close it should give me a message box ask for

"Are you sure you want to change the record"
 
This code in the Before Update event properties

Private Sub Form_BeforeUpdate(Cancel As Integer)
'Provide the user with the option to save/undo
'changes made to the record in the form

If MsgBox("Changes have been made to this record." _
& vbCrLf & vbCrLf & "Do you want to save these changes?" _
, vbYesNo, "Changes Made...") = vbNo Then
Cancel = True
DoCmd.RunCommand acCmdUndo
End If

End Sub

The first line and last line will already be there so do not duplicate them.
 

Users who are viewing this thread

Back
Top Bottom