Link to home
Start Free TrialLog in
Avatar of CFMI
CFMIFlag for United States of America

asked on

access vba change command button backcolor

I've read many FAQS and cannot seem to make a simple event occur.  I'm trying to change the backcolor of a button on click.  I've tried:
1)  Me.cmd_aCks.BackColor = RGB(224, 224, 184)
2)  Me.cmd_aCks.BackColor = &HAFDCCD
3)  Me.cmd_aCks.BackColor = vbRed
4)  Me.cmd_aCks.BackColor = 7405514 - which errors
5)  Me.cmd_aCks.BackColor = #A7DA4E

I'm really going for green but it doesn't matter which color is above, or even which method - the button won't change color on click (or on form open).  Full code looks like this:
Private Sub cmd_aCks_Click()
    Me.cmd_aCks.BackColor = RGB(224, 224, 184)
End Sub

Oh, BTW above code fails but THE CODE BELOW WORKS (even if it isn't what I want to change)!
Private Sub cmd_aCks_Click()
    Me.cmd_aCks.ForeColor = RGB(224, 224, 184)
End Sub
ASKER CERTIFIED SOLUTION
Avatar of rshq
rshq
Flag of Iran, Islamic Republic of image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CFMI

ASKER

That worked.  Thanks very much.
" Unfortunately, you can't change the back color of a command button."

mx