What's usually done, to get around this, is to create a label or use an image and set its SpecialEffect property to Raised. On the MouseDown set the SpecialEffect to Sunken, and on the MouseUp set the SpecialEffect back to Raised. Use the Click event to treat it like a button...
What I have done is I made my cmd button transparent and slightly over sized, then placed a coloured label behind it. Make sure you use the "send it to back" for your coloured label.
In the web address of the button I put a space so the pointer changed to a hand so the button was identified when passed over. This gives the appearance of the button being any colour when in fact it is simply the background.
I got all of this from this forum through a variety of separate posts.
As Miles said, you can't change the color of a button.
You can use images.
But you can't change the color of the image on the fly.
You can however change what image is shown.
What's usually done, to get around this, is to create a label or use an image and set its SpecialEffect property to Raised. On the MouseDown set the SpecialEffect to Sunken, and on the MouseUp set the SpecialEffect back to Raised. Use the Click event to treat it like a button...
This works very well and gives me a very acceptable result except that there is a noticable delay between cliking the button, the button showing pressed and then the command executing.
I'm in A2003. The form I have is fairly involved with 10 tabs, and a lot of code. So the question: Is it my form or is it the label, mousedown, mouseup, command code that is the problem?