Access 2003.
Is there a way to set the background colors of objects by code behind a
form?
For example, have all the lables ( lbl* ) set to one color or transparent,
the data fields set to another ( str* ), boxes to another ( box* ) etc...
I am designing the user interface and setting these colors for each field
manually is a real pain in the butt since we have tons of fields per form
and tons of forms....and we still haven't decided on a specific color scheme
yet. :( Each workgroup will have their own version of the front end with a
different color scheme....
The basic synthax is Me.FormControlName.BackColor = ColorNumber
Example
Me.txtPassword.BackColor = 2220398
You could easily cover the previous into a more generic function which loops
through all the control on a form and reset the background color based on the
type of control using a case statement.
The following might help you get started
**************
Dim ctl As Control
For Each ctl In Me.Form.Controls
Select Case ctl.ControlType
Case acTextBox
ctl.BackColor = 2220398
Case acLabel
ctl.BackColor = 638934
Case acListBox
ctl.BackColor = 3346278
'...
'Check vba help on ControlType for a complete listing
Case Else
End Select
Next ctl
**************
It loops through all the controls on a form and changes the backcolor per
the preset values.

Signature
Hope this helps,
Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.com/index.php
Please rate this post using the vote buttons if it was helpful.
> Access 2003.
> Is there a way to set the background colors of objects by code behind a
[quoted text clipped - 6 lines]
> yet. :( Each workgroup will have their own version of the front end with a
> different color scheme....
AccessNubee - 27 May 2008 03:04 GMT
This is exactly what I have been looking for !!! :)
I put it in the "OnLoad" event and it changes everything to the colors I
specify. Now all I have to do is change the colors in the code once. This is
soo much faster than editing all the controls individually during
development....
I do understand that once we get the colors the way we want it, it should be
entered in the properties of the controls. :)
Oh and by the way, in case anyone out there doesn't know this, if you open
Windows Calculator and change it to scientific, you can click the HEX
option, enter any hex color code, then select the Dec (decimal) button and
you get the color number for Access. :)
> The basic synthax is Me.FormControlName.BackColor = ColorNumber
>
[quoted text clipped - 46 lines]
>> a
>> different color scheme....
Jan Baird - 27 May 2008 20:52 GMT
Jan Baird is out of the country until September 20. Every effort will be
made to respond to messages, but please be patient.
Jan Baird - 27 May 2008 20:51 GMT
Jan Baird is out of the country until September 20. Every effort will be
made to respond to messages, but please be patient.
Also, if you want the changes to stick, you'll need to do the mod in design
mode and save the changes.

Signature
Hope this helps,
Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.com/index.php
Please rate this post using the vote buttons if it was helpful.
> Access 2003.
> Is there a way to set the background colors of objects by code behind a
[quoted text clipped - 6 lines]
> yet. :( Each workgroup will have their own version of the front end with a
> different color scheme....
Jan Baird is out of the country until September 20. Every effort will be
made to respond to messages, but please be patient.