save changes question

O

Orna

Hi,

How do I set access to prompt the question whether to save changes or not
after any change in form or report?

Thanks,
Orna.
 
A

Allen Browne

You must use the BeforeUpdate event of the form (not controls) to do this:

Private Sub Form_BeforeUpdate(Cancel As Integer)
If MsgBox("Save?", vbOkCancel, "Confirm") <> vbOk Then
Cancel = True
'Me.Undo
End If
End Sub

Access fires this event just before the changes are committed. It is the
only way you can catch all the possible means by which a save could occur,
e.g. tabbing past the last field, navigation buttons, applying a filter,
changing the sort order, closing the form, closing Access, keyboard shortcut
(Shift+Enter), menus, toolbars, ribbons, find, search, ...
 
O

Orna

Hi Allen,

Thanks for your response, but this is not my problem.
I am currentlly working on a database which I didn't create by myself and
after any change I make I don't get the built in question of access whether
to save changes or not and it automatically saves any changes.
My question was if there is a setting in access to avoid this behaviour.

Thanks,
Orna.
 
O

Orna

I managed to solve the problem. all macros in the application had
"SetWarning=No" at the begining, without "SetWarnings=Yes" at the end. After
adding the new line to all macros it worked ok.

Thanks,
Orna.
 
Top