conditional form background colour

  • Thread starter Thread starter ripthorn
  • Start date Start date
R

ripthorn

hi,

I've got an access 2000 form with a tick box on it. I want the forms
background colour to change if this box is ticked.

How can i do this ?

Many thanks.

Nigel
 
Hi Nigel,

In design view, click on your checkbox, press F4 to bring up the
properties, then select the "Event Tab". In the AfterUpdate propert
select "Event Procedure" then Click the "..." button next to it. The
VBA Editor will open up. Paste the following code between the Private
Sub... and End Sub lines:

If Me.yourCheckBoxName.Value = True Then
Me.Detail.BackColor = 14742526
Else: Me.Detail.BackColor = 1776523
End If

Replace yourCheckBoxName with the name of your check box. (Can be found
in the line Private Sub yourCheckBoxName_AfterUpdate() line)


The numbers there are the colors. To get the numbers for the colours
you want, click on the form background and choose the two colours you
want one at a time and note down the numbers access assign to that
colour.

Hope this helps,

David


End Sub
 
thanks, that works a treat !! :)

I've also put that code in the on.current of the form so it changes
when it loads =)

thanks, great ! thank you again !!!!!
 
Back
Top