Solved Save textbox control properties on form (1 Viewer)

Babycat

Member
Local time
Today, 23:15
Joined
Mar 31, 2020
Messages
275
Hi Everyone,

I have simple task but I have not configured how to do it efficient.

I make color picker box for end-user to change a textbox color in any color they want by vba code
Textbox1.ForeColor = 'somevalue'

This color should be kept on next time the form open, so I tried to save it when form close by acSaveYes:
DoCmd.Close acForm, Me.Name, acSaveYes

But it is not working, the color is back to default when in design mode... How can I deal with this? Please help
 

Minty

AWF VIP
Local time
Today, 17:15
Joined
Jul 26, 2013
Messages
10,371
Changing the colour in VBA doesn't change it in design view, that is the only instance of a form that will save design changes.
One option would be to store the choice in a local table and apply it at form open, but you could be making a rod for your own back.

Generally, a forms design and colours should reflect a theme in the whole database, so really you should be in charge of that based on the overall design and "feel" of the application.

Once you have user-specific colour designs what happens when you issue an update and all their changes are lost, unless you store them in a main table per user... See what I said earlier about making a rod for your own back?
 

Babycat

Member
Local time
Today, 23:15
Joined
Mar 31, 2020
Messages
275
My customer wants to change the form's background color overtime, so the text color should not be fixed. I seem I have to store these colour values on a local table.
btw:
Any difference bwt DoCmd.Close acForm, Me.Name, acSaveYes and acSaveNo
I usually use acSaveNo when closing forms
 

Minty

AWF VIP
Local time
Today, 17:15
Joined
Jul 26, 2013
Messages
10,371
If any changes have been made in design mode then Yes saves them, No doesn't. Simple as that. No is the default, so you can simply not add that on.

It's a weird option really as end-users shouldn't ever get to a forms design, so what's the point, unless you are doing some automated updates to forms, which is the only use for it that I can see.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 12:15
Joined
Feb 19, 2002
Messages
43,296
I presume that your and your customer realize that by allowing the customer to make design changes to the database, you can no longer provide updates to functionality since YOU no longer have the design master. If you send him an updated FE, he loses all his design choices.

There are certain things which you can allow a user to change but, you MUST create a settings table that lives in the BE. It will provide a place to store design preferences for each person. You then have to provide code to apply the custom choices each time a form opens.
 

Babycat

Member
Local time
Today, 23:15
Joined
Mar 31, 2020
Messages
275
If any changes have been made in design mode then Yes saves them, No doesn't. Simple as that. No is the default, so you can simply not add that on.

It's a weird option really as end-users shouldn't ever get to a forms design, so what's the point, unless you are doing some automated updates to forms, which is the only use for it that I can see.
Yes, I have never used VBA to open the form in design view mode.
 

Babycat

Member
Local time
Today, 23:15
Joined
Mar 31, 2020
Messages
275
I presume that your and your customer realize that by allowing the customer to make design changes to the database, you can no longer provide updates to functionality since YOU no longer have the design master. If you send him an updated FE, he loses all his design choices.

There are certain things which you can allow a user to change but, you MUST create a settings table that lives in the BE. It will provide a place to store design preferences for each person. You then have to provide code to apply the custom choices each time a form opens.
Yes, I dont allow end-user to make any design change. I just provide the ability to change a form background and certain textbox color, those changes are made via user-friendly interface such as button, colopicker with underlying VBA code.

In conclusion, I will need a local table to store the changes and apply it to objects when form opens.

Thank for helping me.
 

Minty

AWF VIP
Local time
Today, 17:15
Joined
Jul 26, 2013
Messages
10,371
If you use a local table it will be overwritten every time you release a new version.
If that doesn't bother you or your users that's fine, but if it does, then you will have an issue and need to store the user and form preferences in a linked main DB table.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 12:15
Joined
Feb 19, 2002
Messages
43,296
I said to use a table in the BE and Minty agrees for obvious reasons.
 

Users who are viewing this thread

Top Bottom