Buton Colour

  • Thread starter Thread starter Darren Hunter
  • Start date Start date
D

Darren Hunter

Is there a qick way with out going in to each button of repeating the bit of
code to change the colour of the button on get / lost focus.

If I can create a global sub / function and just callit with the control
name..

Ta
Darren
 
Plain Access buttons are a system color. Stephen Lebans has code to change
their color:

http://www.lebans.com

You can however change the color of the font (forecolor) on the button. Use
some code like this:

Public Function fButtonD(strControlName As String, intWeight As Integer,
lngColor As Long)
With Screen.ActiveForm.Controls(strControlName)
.FontWeight = intWeight
.ForeColor = lngColor
End With
End Function

You can pass a color to the function like this:

Public Function fRed()
fRed = vbRed
End Function

I'd use the MouseOver event to change it.

=fButton("MyButton", 700, fRed())

Then the MouseOver event of the Detail Section to change it back:

=fButton("MyButton", 400, 0)
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Darren,

There are some third-party tools that may help with setting command
button colors:

A shareware version of Button Painter for MS Access is available at
this web site: http://www.peterssoftware.com/bp.htm

Some simple colored button examples that can be copied into your
application are available at: http://www.peterssoftware.com/clrbtn.htm

Stephen Lebans has an example database that shows how to set a command
button back color and more: http://www.lebans.com/cmdbutton.htm

There are nice "Color Command Buttons" downloads at this site:
http://www.candace-tripp.com/access_downloads.htm

Hope this helps,
 
Back
Top