If Tick Box Ticked Change background colour

samjh

Registered User.
Local time
Today, 20:23
Joined
Jan 10, 2013
Messages
64
Hi,

I have a form which is a single form with a subform.
The form shows commitments and the subform shows related income commitments. They are linked through the CommitmentID.

On the Main form there is a tick box which should be ticked if the commitment has been cancelled.

The backgorund colcour of this form and subform is currently set to 85. If the tick box has been ticked I would like it to change to a different colcour, I've not decided what yet, and equally if the tick is taken out of the box, I would want the form to back to being colour 85.

Can someone give me pointers on how I would go about doing this please.

Thanks.
 
In the check box's On Click event put the following code;
Code:
If Me.YourCheckBoxName = True Then
     Me.YourMainFormControl.Backcolor = 80             [COLOR="Green"]'Set this to whatever colour you like[/COLOR]
     Me!Subform1.Form!ControlName.Backcolor = 80       [COLOR="Green"]'Set this to whatever colour you like[/COLOR]
Else
     Me.YourMainFormControl.Backcolor = 85
     Me!Subform1.Form!ControlName.Backcolor = 85
End If

You Would also need this in the Main Form's On Current event.

Also bookmark this link for future reference as it will help you formulate the correct syntax for referring to Forms, SubForms and their control and properties from various relative location.
 

Users who are viewing this thread

Back
Top Bottom