Solved Code not save when at runtime

atzdgreat

Member
Local time
Yesterday, 20:24
Joined
Sep 5, 2019
Messages
42
Hi all does anyone experience about losing their codes even though it was already saved once the form runs or even close. it's like once closing the form, its doing undo.
 
Are you saying that you make code changes when you implement a code fix, switch to Form View mode, and then close the form? And after that sequence, the code changes are not saved?

Or were you describing something else?

Which version of Access are you running?
 
You said "code," but did you actually mean to say "data?"
 
hi thank you for your reply. Yes @The_Doc_Man you're right when i implement a code fix then switching to view mode and then close the form, all the code changes are not saving. so currently what i'm doing right now is to close my access and recode before switching to view mode
 
No. Upload your DB for someone else to test.
 
You should get a "do you want to save your changes?" type message. Maybe you have setwarnings set to off. That might cause your changes to be dropped. Also, if your code closes the form with the setting to not save changes, that might have the same effect also. (I think it's AcSaveChangesNo which refers to saving design changes, not data changes)

One other thing I am not sure about is whether you are getting these issues when running normally, or during development. I tend to issue accde versions, and then code can't be changed. It has to be changed in the development code version, and that version reissued as a new accde. For databases I use myself only, I do make changes during use. The only time I lose them is if my code gets stuck in a loop which I can't stop, and then I can't save the changes. Then I have to repeat the edits and remember to save them before running code. :D
 
Yes, I got in the habit of a Ctrl + S, before trying to run anything. :)
 
I'm thinking that Dave has point about warnings being disabled because I frequently get the "do you want to save changes" question when working on my standalone apps. In fact, that was on my mind when I asked my question for clarification, because you SHOULD be reminded by Access that you have changes pending. This might be something altered via the File >> Options >> Current Database option page although there ARE a few other places where you can make changes to behavioral options.
 
1. Disabled warnings is the most likely culprit when you get no warnings that an object is dirty when you close it.
2. If you change code while it is running, Access doesn't always save immediately. That could be the other part of why you are losing code.

You only have to lose code once or twice maybe to become quite aware that you always "change, save, compile, run" dozens of time during a session.

I created two macros that I use in situations where I want to stop the user from getting warning messages. The macros:
1. Turn warnings off, turn hourglass on
2. Turn warnings on, turn hourglass off

WHY - if you stop the code to debug while the warnings are off, the hourglass will remind you of that so you never forget to save - or run the other macro to turn the warnings back on.
 

Users who are viewing this thread

Back
Top Bottom