Simple yet complex close form problem (1 Viewer)

Adelina_RO

Member
Local time
Today, 19:46
Joined
Apr 9, 2021
Messages
42
The setup: I have a main navform with a few navsubforms. In one of them, depending on what the user clicks, some textboxes turn red or green.
Te problem: when i navigate away from the said subform, access is asking if i want to save the changes to the form or not. I want to disable this message, but i can't use a button to close the form, since it is a navsubform, so i don't know where should i trap this message...
LE: i don't want to use docmd.setwarnings FALSE, because that saves the form by default and i don't want that to happen.
Thank you for any ideeas :)
 

Saphirah

Active member
Local time
Today, 18:46
Joined
Apr 5, 2020
Messages
163
Edit: This does not seem to be your problem, but the link is still usefull, so i will keep it in here :)

I tested it in one of my forms. When you call the DoCmd.CloseForm Method with the Save Property to no, the prompt should not appear.
DoCmd.Close acForm, "Order Review", acSaveNo

There are users though who reported your behaviour in access 2010. One workaround was either the DoCmd.SetWarnings or Upgrading the mdb file to accdb.
 
Last edited:

Minty

AWF VIP
Local time
Today, 17:46
Joined
Jul 26, 2013
Messages
10,368
It will only ask you to save changes if you are closing the form somehow.

That happens on the inbuilt Navigation forms as they silently unload the forms when you switch tabs, rather than actually switching between tabs.
The real solution is to create your own navigation/menu system so that you are in control of the process fully.
 

Saphirah

Active member
Local time
Today, 18:46
Joined
Apr 5, 2020
Messages
163
It will only ask you to save changes if you are closing the form somehow.

That happens on the inbuilt Navigation forms as they silently unload the forms when you switch tabs, rather than actually switching between tabs.
The real solution is to create your own navigation/menu system so that you are in control of the process fully.
I am also not a fan of the built in Navigation forms but they do their job pretty good for simple tasks.
The prompt comes from changing the form (for example the color property) and then closing it.

What you can do to avoid that is, you can change your Textboxes using Conditional Formatting. This will not alter the form in any way but change the display based on variables. You can use absolutely everything as the condition. Be it controls, variables or fields.
And because you do not alter your form the prompt will not appear.
 
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Today, 09:46
Joined
Oct 29, 2018
Messages
21,454
The setup: I have a main navform with a few navsubforms. In one of them, depending on what the user clicks, some textboxes turn red or green.
Te problem: when i navigate away from the said subform, access is asking if i want to save the changes to the form or not. I want to disable this message, but i can't use a button to close the form, since it is a navsubform, so i don't know where should i trap this message...
LE: i don't want to use docmd.setwarnings FALSE, because that saves the form by default and i don't want that to happen.
Thank you for any ideeas :)
Okay, I was curious, so I just gave it a try. I created a Navigation Form and added code to change control properties in the subforms to change colors. When I switch from tab to tab, I don't get the save prompt/warning you described. So, I am wondering if it depends on the code you're using. Can you please post the code to change the color of the textbox?
 

Adelina_RO

Member
Local time
Today, 19:46
Joined
Apr 9, 2021
Messages
42
Hey :) sorry for the late reply, but it's summer :D
To sum everything up:
-firstly, it is an accdb i'm working on, not mdb, and
- i do change one textbox's back color property, but i need it that way. i want to show the color the user picked from the color picker dialog, which brings me to
- i can't use conditional formatting for this exact reson: i don't know what color the user will pick, to set up rules
- moreso, if i disable warnings, it will save the form by default, and i don't want that.
- lastly, i think that, with some minor adjustments, NavControl is quite usefull, responsive and very low on memory consumption, as it unloads all the unused forms by default so, except for this one problem, i don't see the need to build it from the grounds up. Especially since i'm very lazy :D

So in the end, i guess i'll close this thread since there is no viable option for the moment. Thank you everyone :)
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:46
Joined
Oct 29, 2018
Messages
21,454
Hey :) sorry for the late reply, but it's summer :D
To sum everything up:
-firstly, it is an accdb i'm working on, not mdb, and
- i do change one textbox's back color property, but i need it that way. i want to show the color the user picked from the color picker dialog, which brings me to
- i can't use conditional formatting for this exact reson: i don't know what color the user will pick, to set up rules
- moreso, if i disable warnings, it will save the form by default, and i don't want that.
- lastly, i think that, with some minor adjustments, NavControl is quite usefull, responsive and very low on memory consumption, as it unloads all the unused forms by default so, except for this one problem, i don't see the need to build it from the grounds up. Especially since i'm very lazy :D

So in the end, i guess i'll close this thread since there is no viable option for the moment. Thank you everyone :)
Hi. Not sure if you saw my last post. I tried to duplicate your scenario and didn't have any problems like you described. Not sure what that says, but just thought I'd mention it. Good luck with your project.
 

Adelina_RO

Member
Local time
Today, 19:46
Joined
Apr 9, 2021
Messages
42
Hi. Not sure if you saw my last post. I tried to duplicate your scenario and didn't have any problems like you described. Not sure what that says, but just thought I'd mention it. Good luck with your proj
There is no special code, just Parent!Ctl.BackColor = Rst!BckColor - where Rst!BckColor is a field in a table.
The thing is that i can't believe it won't ask you anything, unless you are using setwarnings false, which i don't want to do.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:46
Joined
Oct 29, 2018
Messages
21,454
There is no special code, just Parent!Ctl.BackColor = Rst!BckColor - where Rst!BckColor is a field in a table.
The thing is that i can't believe it won't ask you anything, unless you are using setwarnings false, which i don't want to do.
No, I'm not using setwarning false, I never do that. All I did was create a new blank db and simply added a navigation form with a couple of tabs. I added a button to change a color in one of the controls in one of the tabs. That's all I did.

When I open the nav form, I click the button to change the color and then switch tabs. No warning prompts for me. Have you tried experimenting with a new db file? Just a thought...
 

Users who are viewing this thread

Top Bottom