How do you turn off autosave in Access during design?

baytowel
baytowel used Ask the Experts™
on
While designing in Microsoft Access the object is saved automatically without prompting.  This happens whether the object is a query, a form, etc.  If you exit without saving and then reopen the db, the changes have been saved and your original is lost.  This is particularly frustrating during 'what if' designing.  Is there a way to turn this autosave off during design?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
Open the VBA editor and bring up the Immediate Window.

Type in:

DoCmd.SetWarnings False

and hit Enter

See if the issue is resolved.

mx

Author

Commented:
Nope - same thing.  I can open a form, query, or report and change somehing and when I close it, it just closes with no prompting to save (but it does save it).  This happens with one specific database and not any others.

I have done 'compact and repair', and also created a new database and imported all the objects from the old one into the new one - it still does this, but just on this one database (our most important production database of course....)
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
Have to ask ... have you rebooted since this started (seriously) ?

There is no autosave feature in Access per se.

The usual culprit is executing a DoCmd.Setwarnings False ... and the corresponding DoCmd.Setwarnings True does NOT get executed.

mx
How to Generate Services Revenue the Easiest Way

This Tuesday! Learn key insights about modern cyber protection services & gain practical strategies to skyrocket business:

- What it takes to build a cloud service portfolio
- How to determine which services will help your unique business grow
- Various use-cases and examples

Author

Commented:
Yes - have rebooted - this is an ongoing problem with this database (5 years +)

Does setwarnings 'reset' itself when the database is closed down and restarted, or does it remember its last state?  I do use setwarnings off and on in some macros....

And in either case - if I want it to warn me about saving design changes, wouldn't the test be "docmd.setwarnings true" instead of false like the first post?

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
"Does setwarnings 'reset' itself when the database is closed down and restarted, "
Yes ... it does reset.

Are you *Positive* that in this db, for EVERY SetWarnings False ... you have the corresponding SetWarnings True  ?






Database Architect / Application Developer
Top Expert 2007
Commented:
Here is my general bit on the SetWarnings issue:


Let me suggest a safer way ... that gets away from the SetWarnings False - which can have many undesirable ramifications.  

The problem with SetWarnings False is ... if one (or more) of the queries fail for *whatever* unexpected reason ... you will never know this because SetWarnings False masks out *all* errors, which can lead to you *thinking* that everything ran ok, when in fact it did not.

The approach below has two advantages:

1) You do not get the warning prompts - just like if you use SetWarnings False ... AND ...
2) If an Error DOES occur, it will be trapped and you can act accordingly.

Private Sub btnRunQry_Click()
   
    On Error GoTo btnRunQry_Click_Error
    CurrentDb.Execute "SomeActionQuery1", dbFailOnError
    CurrentDb.Execute "SomeActionQuery2", dbFailOnError
    MsgBox "Operation completed successfully!"

btnRunQry_Click_Exit:
    Err.Clear
    Exit Sub

btnRunQry_Click_Error:
   MsgBox "An error occurred:" & vbCrLf & Err.Number & vbCrLf & Err.Description
   GoTo btnRunQry_Click_Exit
End Sub

******

Another problem with SetWarnings False is ... if you *forget* to execute SetWarnings True ... OR ... some other error does occur and SetWarnings True does not get execute ... you have a big problem ... because, False stays in effect unit you close and reopen Access.  

So, for example if you are working in design view of say a form (or table, etc) ... and you make some changes ... and hit Save ... you are NOT prompted for 'Do you want to save these changes ...". I will just silently save the changes ... which may NOT be what you wanted to do!!


mx

Author

Commented:
Looks like this is probably the issue - so points all around!  I can not guarantee that for every false there is a true, and there may be a place or two in the logic that allows an escape/exit before the true in certain circumstances.  

I'll try your posted code in a few spots to see if that helps the issue.

Thanks for the help.

T.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial