Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Colored Command Buttons (*Tip*)


Message #1 by Lonnie Johnson <prodevmg@y...> on Wed, 31 Oct 2001 11:21:47 -0800 (PST)
Colored Command Buttons.



Here is a little tid-bit that may be helpful in adding some snaz to your forms. Command buttons are just rectangle objects with
certain properties and events already programmed. The following steps will allow you to create your own command button in any color
you wish.



   Place a rectangle on a form. ( I will call it rect1)

   Set the following properties:

Back Style = Normal

Special Effect = Raised

Back Color = (What ever you like)

   In the rectangle?s On Mouse Down event put?

rect1.SpecialEffect = 2 ?The number 2 is the VBA code for Sunken. 

And in the On Mouse Up event put?

rect1.SpecialEffect = 1 ?The number 1 is for Raised.

So when you click the rectangle it will give the appearance that it is going down and coming back up.





Now you have a command button!







Place a procedure in the rectangle?s click event. (MsgBox "Hello")



You can also put a label or image over the rectangle. This will allow you to have custom text or graphics. If you do this, you must
put the same code in the label (or image?s) On Mouse Down, On Mouse Up and Click events that you put for the rectangle.



 





Lonnie Johnson ljprodev@y... 

ProDev, Builders of MS Access Databases

Let ProDev build your next MS Access database application. 

http://www.galaxymall.com/software/PRODEV 




  Return to Index