Check box colors the form controls

Pusher

BEOGRAD Put
Local time
Today, 19:47
Joined
May 25, 2011
Messages
230
Hi all,
I need to color all my combo boxes and text boxes with the same color when i click a check box in a form. Can this be done?
Thanks
 
In the check Box's On Click event you could use some code along the lines of;
Code:
If Me.YourCheckBox = 0 Then    [COLOR="SeaGreen"]'0 or False or No[/COLOR]
     Me.YourControl1.BackColor = 16777215      [COLOR="SeaGreen"]'White[/COLOR]
     Me.YourControl2.BackColor = 16777215      [COLOR="SeaGreen"]'White[/COLOR]
     [COLOR="SeaGreen"]'...and so on[/COLOR]
Else
     Me.YourControl1.BackColor = 225     [COLOR="SeaGreen"]'Red[/COLOR]
     Me.YourControl2.BackColor = 225     [COLOR="SeaGreen"]'Red[/COLOR]
     [COLOR="SeaGreen"]'...and so on[/COLOR]
End If
You would also need this same code in the Form's On Current event.
 
Thanks that did it :)
What is the yellow color number and can it be made to FLASH somehow (Yellow and white) ?
 
The code for Yellow is 65535.

To get the back colour to flash use the following in the Form's On Timer event;
Code:
    If Me.ComboName.BackColor = 65535 Then
        Me.ComboName.BackColor = 16777215
    Else
        Me.ComboName.BackColor = 65535
    End If
You will also need to set the Form's Timer Interval to 400. You play with the number to adjust the speed of the flash to a rate that you like. The larger the number the slower the blink rate.
 
Do i leave the other code or just the timer? I can't make it work for some reason :(
 
When i check the box in the record i want it to flash - when i am on that record. On the other records i want nothing to happen.
 
Something along the lines of;
Code:
If Me.CheckBox = 0 Then
    Me.ComboName.BackColor = 16777215
    Exit Sub
else
    If Me.ComboName.BackColor = 65535 Then
        Me.ComboName.BackColor = 16777215
    Else
        Me.ComboName.BackColor = 65535
    End If
End If
Should do the trick
 
Where did you get this numbers? I cant find it... :(
 
Where did you get this numbers? I cant find it... :(

Put any form into design view, click on the Back Colour or Fore Colour of any control, Click on the Ellipsis (...) button select the colour you want and check the numbers.
 

Users who are viewing this thread

Back
Top Bottom