Display Colour Selection To Fill Control

TimTDP

Registered User.
Local time
Today, 21:18
Joined
Oct 24, 2008
Messages
213
To change the backround colour of a control using vba I would use:
me.ControlName.BackColor = ColourNumber, eg #ED1C24 for red

I would like the user to select their own colour.

If in design mode, I select: control, properties, format and hit the build "..." button on Back Color, a list of colour options is displayed

How do I show these colour options in vba?

So, if the user dbl clicks on the control, the colour options appear, user slects a colour, selection is saved as control's BackColor

I am using Access 2010

Thanks in advance
 
I feel that what you are attempting won't work. What I would do is create a pop-up form with a number of text controls, maybe as squares, and either state their colour e.g. red or colour it accordingly.

The user should double-click to select the colour. This will then allow you to use the response to set the colour you need.

It will need you to be smart with the control names to know which one is double clicked eg. txtred

You could also use a Select Case statement to pick up the control selected. If you use RGB as well, then you can have loads of colour options.
 
Last edited:
The saving of the BackColor will only be temporary while the Form is open.
You will also need to save the selected colour in a table and set the control BackColor when the Form is opened.

Apart from that it is certainly doable in previous versions of Access.

There is a demo in the Sample Database Forum here: -
http://www.access-programmers.co.uk/forums/showthread.php?t=204786

Right click the board and select Configuration.
Don’t forget to save the selected colour(s).

Chris.
 

Users who are viewing this thread

Back
Top Bottom