Why does MS Access not ask to save and automatically save on close

I use MS Access 2010.
In the last week I experience a problem that when I open a form or a query and change something just to try it out, Access saves the changes on close without warning.
Also if I create a form or a query and want to abandon, I cannot close and move away. The only option is to save with some name which I can delete subsequently.
I have right now closed Access and reopened and it works properly again.
This was never like this and can have disastrous consequences.
I have searched the web, but I have not found a solution there.
Can anyone advise, please?
Fritz PaulAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PatHartmanCommented:
Do you have code that is setting warnings off and on again?  This will change the way that Access behaves.

When I toggle these settings in code, I use macros.  These are the ONLY two macros I use in my apps.  The "off" macro sets the warnings Off and sets the hourglass on and the "on" macro sets the warnings on and the hourglass off.  I do this to give myself a visual breadcrumb that I have turned warnings off.  So if I'm testing and stop the code before I turn warnings back on or forget to add the on macro to the correct place in the code, I know I can just run the macro to turn the warnings back on and if it happened accidentally, I know I need to find the procedure with the missing "on" macro.
0
Dale FyeCommented:
The way to cancel an update or to cancel a new record is to press the ESC button on you keyboard.  Pressing that once will cancel the most recent change on the form.  Pressing it twice will cancel the new record entirely if you are on a new record.

Personally, I have a Form_BeforeUpdate event on almost every form that has data which can be edited.  This event fires if the form is dirty (is new or has changes), and can be cancelled if not all required fields have been entered, but to do that you would have to write some VBA code, something like:
Private Sub Form_BeforeUpdate(Cancel as Integer)

    Cancel = true
    if Trim(me.txt_Field1 & "") = "" then     'this checks to make sure that Field1 contains something
        msgbox "Enter a value in Field1"
   elseif Trim(me.txt_Field2 & "") = "" then 
        msgbox "Enter a value in Field2"
   Else
       Cancel = false
   end if

End Sub

Open in new window

 This process will prevent the current record from being saved if either Field1 or Field2 does not have some form of data entered in it.
1
Fritz PaulAuthor Commented:
Thanks Pat that is interesting. I am implementing.
0
PatHartmanCommented:
Good.  At least you'll have some indication that your code is leaving the state of the set warnings off.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Fritz PaulAuthor Commented:
Thanks, It seems to be working. I have not encountered the hourglass yet, but also not the issue.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.