save changes question

  • Thread starter Thread starter Orna
  • Start date Start date
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.
 
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, ...
 
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.
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top