Changing Background of Command Button

M

MacNut2004

Hello,

Is changing the background color of the command button possible? I know i
can change the FOREcolor (the font color) of the type in there but i want to
change the background of that command button using VBA.

Please let me know!

MN
 
M

Maurice

Nope not possible through VBA. But why not use a rectangle and place an
On_Click on that. You can place your code behind it and you can alter the
colors the way you like it.
 
M

MacNut2004

Well I COULD do that...but I have 15 reports using 15 command buttons...so
I'd have to create 15 different rectangles and grab the code from each
command button....could be more work than it's worth?
 
M

Maurice

Yep, your right on this one but on the other hand I never understood why
people want to change the backcolor of a commandbutton... no offense ;-)
I don't know what each button does but if it does the same trick you could
place it in a public sub and call it from there.
 
M

MacNut2004

Well each command button opens a different report...not the same report.
Also...how come when i put the code into the "onclick" event of that box
....nothing happens wheni click on it? Also....i can't change the color of
the box in VBA using the "backcolor" property and setting that = vbGreen.

Help!

Thanks
 
F

fredg

Well each command button opens a different report...not the same report.
Also...how come when i put the code into the "onclick" event of that box
...nothing happens wheni click on it? Also....i can't change the color of
the box in VBA using the "backcolor" property and setting that = vbGreen.

Help!

Thanks

Not using Access as delivered.

1) You can use an UNATTACHED label control, color it as you wish.
Set it's SpecialEffects property to Raised, and code it's Mouse Up
event (LabelName.SpecialEffect = 1) and Mouse Down event
(LabelName.SpecialEffect = 2) to simulate movement.

Then code the label's click event as you would a command button.

2) Set a colored background as the Command Button Picture
property. You can use MSPaint to create the colored (all blue or all
green, etc.) picture background.
(Include the caption in the MSPaint picture, not in the command button
caption property.) A small bit of practice to get the size right, but
once you do it it's easy.

3) See
http://www.lebans.com
for his command button color work-around.
 

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