Changing background color by code

G

Guest

I have a form that has a toggle button it. I would like to include some code
on the toggle button that if the button is 'yes' it would change the
background color of the form to one color, but if it is 'no' it would use the
default color of the form.
Right now, the default color of the detail section of the form is 13056.
I believe that I would end up using the 'On Click' event, and the code would
be along the lines of:
If Toggle104 = -1 then
(?)
Else
(?)

Could someone possibly help me in filling in the question marks?
 
G

Guest

Hi Steve,

Try this:

Private Sub Toggle0_Click()
If Toggle0.Value = -1 Then
Me.Detail.BackColor = vbRed
Else
Me.Detail.BackColor = 13056
End If
End Sub
 
M

Marshall Barton

Steve said:
I have a form that has a toggle button it. I would like to include some code
on the toggle button that if the button is 'yes' it would change the
background color of the form to one color, but if it is 'no' it would use the
default color of the form.
Right now, the default color of the detail section of the form is 13056.
I believe that I would end up using the 'On Click' event, and the code would
be along the lines of:
If Toggle104 = -1 then
(?)
Else
(?)


Me.Section(0).BackColor = 13056
or
Me.Section(0).BackColor = RGB(255,192,192) 'Pink
 
G

Guest

Thank you. I will give that a try the next time I am sitting down to work on
the database.
 

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