conditional form background colour

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
 
D

Daveo

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
 
R

Ripthorn

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 !!!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top