Command Button Color

  • Thread starter Thread starter James T.
  • Start date Start date
J

James T.

Access 2000

I have looked everywhere to try and change the color of a
command button, but all I can find is changing the fore
color. Help talks about the BackColor but I don't see this
anywhere.

Can someone please steer me in the right direction?

Thanks!

James
 
I don't believe there's a way to change the color of the command button, but
then again I'm still using Access 97.

What I've done in the past is made a label look like a button...raised.
Then I've written some code in the "On Mouse Down" and "On Mouse Up" events
that will make the label look sunken and then raised again. Then you can
write some code in the "On Click" event to give the "button" a function.

Example: a button (Label named "LblClose") that will close a form

Private Sub LblClose_Click()
DoCmd.Close
End Sub

Private Sub LblClose_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
LblClose.SpecialEffect = 2
End Sub

Private Sub LblClose_MouseUp(Button As Integer, Shift As Integer, X As
Single, Y As Single)
LblClose.SpecialEffect = 1
End Sub

It does a pretty good job and, in many cases, will be able to function
exactly as a command button would.

Just a suggestion.

Tom
 
-----Original Message-----
I don't believe there's a way to change the color of the command button, but
then again I'm still using Access 97.

What I've done in the past is made a label look like a button...raised.
Then I've written some code in the "On Mouse Down" and "On Mouse Up" events
that will make the label look sunken and then raised again. Then you can
write some code in the "On Click" event to give the "button" a function.

Example: a button (Label named "LblClose") that will close a form

Private Sub LblClose_Click()
DoCmd.Close
End Sub

Private Sub LblClose_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
LblClose.SpecialEffect = 2
End Sub

Private Sub LblClose_MouseUp(Button As Integer, Shift As Integer, X As
Single, Y As Single)
LblClose.SpecialEffect = 1
End Sub

It does a pretty good job and, in many cases, will be able to function
exactly as a command button would.

Just a suggestion.

Tom






.
Tom,

Thanks, I just gave it a try and I am getting an error
on Lbl1.SpecialEffect = 2 (I took the default name of the
label, 1).

Any ideas?

Thanks,
James
 
Please disregard my previous post. I had a slight spelling
error :-(

Thanks! It works great!

James
 
See:
http://www.lebans.com/cmdbutton.htm
CommandButton.zip is a database containing functions to allow a user
defined BackColor and Rotated Text for Command Buttons.

NEW - Jan. 26/2000 This version includes 2 functions. One for Form
Design view and one for Form View at Runtime.

1) Use API Color Dialog to select BackColor.

2) User Selectable degrees of rotation for Text in controls Caption.

3) Use in Form Design or Form View at Runtime.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Back
Top