Form details colour control

Beady

Registered User.
Local time
Today, 17:52
Joined
Dec 18, 2000
Messages
24
Hi,

I have a couple of identical databases in Access 97, they have lots of forms. My users use the two different versions of this database, but linked to different sets of data depending on what they are doing.

I distinguish between the two versions by making the background colour of the log on and Switchboard forms different. It would be nice if I could cause the background colour of the other forms to match the Switchboard without having to go through and change each form individually.

Can someone please give me a clue as to how this can be done?

I know using Me.Detail.BackColor = RGB(100, 100, 255) would work, but I can't see how to a) get the RGB values from the Switchboard.

Regards,

Bernard D
 
you can just enter the decimal number that is shown as foreground/background colour after you select the eillipsis (...) to select the colour in the properties table of a textbox etc. If you want the individual RGB numbers select 'Define Custom Colurs' from the popup box.

cheers
 
johncallaghan said:
you can just enter the decimal number that is shown as foreground/background colour after you select the eillipsis (...) to select the colour in the properties table of a textbox etc. If you want the individual RGB numbers select 'Define Custom Colurs' from the popup box.

cheers
Thanks, I know I can change the colour from the properties panel, or use the colour selector.

What I actually want to do is change the colour of the Switchboard form and have the same colour automatically be used on all of the other forms in the app.

I know I'll have to put some form of code into the Onload event for each of these forms and it's that code that I need.

I have just one source file and simply swap the linked file info for each of the data sources, I'd like the change to be visually obvious by having different coloured forms for each, but not having to go through all of the the forms to alter the properties.

Cheers,

Bernard D
 
I haven't tested this but something like :

Sub Update backgroundColor()
Dim ctl As Control
DoCmd.OpenForm "Form1", acDesign
'Loop through each control on the form to get its value.
For Each ctl In Forms("Form1").Controls
With ctl
Select Case .ControlType
Case acDetail
ctl.back color = Replace(ctl.back color, " 16777215", " 12632256")
'example , this changes white to grey
End Select
End With
Next ctl
DoCmd.Close acForm, "Form1", acSaveYes
End Sub

Hth
 
Thanks for that suggestion. I'll have a look at it.
 
Just for the record I've found a way of doing this. It's very simple and I'm sure that there are better ways, but this works for me.

On the Switchboard form I've put three hidden fields, called myRed, myGreen and myBlue respectively with their default values set to the correct RGB values.

On each form I have an Event Procedure in the OnOpen event which simply contains:
Me.FormFooter.BackColor = RGB(Forms![Switchboard]![myRed], Forms![Switchboard]![myGreen], Forms![Switchboard]![myBlue])
Me.FormHeader.BackColor = RGB(Forms![Switchboard]![myRed], Forms![Switchboard]![myGreen], Forms![Switchboard]![myBlue])
Me.Detail.BackColor = RGB(Forms![Switchboard]![myRed], Forms![Switchboard]![myGreen], Forms![Switchboard]![myBlue])

Now all I need to do is to change the default values in the three fields in the Switchboard form and the all the other forms change their colour when they are opened.

Thanks for the suggestions.

Regards,
Bernard D
 

Users who are viewing this thread

Back
Top Bottom