Urgent!!! Automatic Record saving on Forms

wjoc1

Registered User.
Local time
Today, 23:53
Joined
Jul 25, 2002
Messages
117
Hi,

I'm using forms to display and update records in my database. However when a user exits/closes the form, Access automatically saves any changes made to that record without any prompt. I need to set up the form so that when a user exits the form, the changes they have made are not automatically saved. (I have a seperate save button for this and I want users to use this explicitly)

I have tried using an undo button running a simple macro underneath. My theory is that the undo button simply "undo's" any changes and the macro it runs then closes the form. However this doesn't seem to work! It just exits/closes the form and all the changes are saved!

Please, please HELP!!!

Liam
 
Function Conf()
Dim Msg, Style, Title, Response, MyString, frm As Form

Beep
Msg = "You have altered existing data are you sure you wish to do this?"
Style = vbYesNo + vbExclamation + vbDefaultButton1
Title = "Confirm record change"
Response = MsgBox(Msg, Style, Title)
If Response = vbNo Then
Screen.ActiveForm.Undo
Exit Function
DoCmd.RunCommand acCmdSaveRecord

End If
End Function


Private Sub Form_BeforeUpdate(Cancel As Integer)
If Not Me.NewRecord And Me.Dirty Then
Call Conf
End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom