Solved Code not save when at runtime (1 Viewer)

atzdgreat

Member
Local time
Yesterday, 16:39
Joined
Sep 5, 2019
Messages
32
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.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 18:39
Joined
Feb 28, 2001
Messages
27,208
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?
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:39
Joined
Oct 29, 2018
Messages
21,485
You said "code," but did you actually mean to say "data?"
 

atzdgreat

Member
Local time
Yesterday, 16:39
Joined
Sep 5, 2019
Messages
32
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
 

Gasman

Enthusiastic Amateur
Local time
Today, 00:39
Joined
Sep 21, 2011
Messages
14,336
No. Upload your DB for someone else to test.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 00:39
Joined
Sep 12, 2006
Messages
15,660
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
 

Gasman

Enthusiastic Amateur
Local time
Today, 00:39
Joined
Sep 21, 2011
Messages
14,336
Yes, I got in the habit of a Ctrl + S, before trying to run anything. :)
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 18:39
Joined
Feb 28, 2001
Messages
27,208
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.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 19:39
Joined
Feb 19, 2002
Messages
43,328
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.
 

MarkK

bit cruncher
Local time
Yesterday, 16:39
Joined
Mar 17, 2004
Messages
8,186
Hit <Ctrl> + S all the time.
 

Users who are viewing this thread

Top Bottom