<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener("load", function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <iframe src="http://www.blogger.com/navbar.g?targetBlogID=34083602&amp;blogName=LEARN+MS-ACCESS+TIPS+AND+TRICKS&amp;publishMode=PUBLISH_MODE_FTP&amp;navbarType=BLUE&amp;layoutType=CLASSIC&amp;searchRoot=http%3A%2F%2Fblogsearch.google.com%2F&amp;blogLocale=en_US&amp;homepageUrl=http%3A%2F%2Fwww.msaccesstips.com%2F" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" height="30px" width="100%" id="navbar-iframe" allowtransparency="true" title="Blogger Navigation and Search"></iframe> <div></div>
www.msaccesstips.com

LEARN MS-ACCESS TIPS AND TRICKS


International Response Fund

LEARN MS-ACCESS TIPS AND TRICKS

↑ Grab this Headline Animator

Your Ad Here
Thursday, April 03, 2008

Colorfull Command Buttons

We have seen Double-Action Command Button in the earlier Post and Command Button Animation before and now it is time for adding some color to the Command Buttons. Take a look at some different Command Buttons in action on a Control Screen (Main Switchboard) of a sample Ms-Access Application.


Colorfull Buttons Demo Image

Like to use them on your Application? You may be expecting some lengthy lectures from me about them. Or may be expecting about hundred or more lines of VBA Code to copy from the bottom of this Article to paste into your Project. Or you are getting prepared to download some MS-Access Add-Ons from Internet and install them into your machine. Probably one or two Library Files to link with your Project too, right?


No, you don’t have to do any of those things to create and put these Command Buttons on your Project. You can create one Button in two minutes, well, may be 3 minutes when you create it for the first time. You can create the variants of the same button in less than one minute’s time.


I know you waited for so long for me to come to the point. These Buttons are not created in MS-Access. We have to create them in MS-Word (if you prefer Excel, it’s ok with me), copy and paste them into MS-Access Form, and make few changes in the Property Sheet of the Button. May be one or two lines of Code for Button Animation and you are ready to roll.


  1. Open your MS-Access Project and open a Form and keep it in Design View.

  2. Open MS-Word and check whether the Drawing Toolbar is visible at the bottom above the Status Bar. If it is not there then select View - -> Toolbar - -> Drawing. If the Drawing Toolbar Button is visible on the Toolbar above, you can click on it to bring it up too.

  3. Click on the AutoShapes - -> Basic Shapes - -> Rounded Rectangle Tool.


  4. Colorfull Buttons Demo Image

  5. Draw a Rounded Rectangle.


  6. Right-Click on the shape that you have just drawn and select Format AutoShape from the Shortcut Menu.


  7. Select Colors and Lines Tab on the displayed control and Click on the Color drop-down list under Fill values group.


  8. Rounded Rectangle Drawing Tool Image


  9. Click on the Yellow Color on the Color Pallette and then Click on the Fill Effects… Control.



  10. Gradient Color Menu Image



  11. Select the Gradient Tab and select Vertical under Shading Styles and click on the right bottom corner shape under the Variants category. The selected shape appears under the Sample heading at the right.

  12. Click OK and OK again on the Format AutoShape control to paint the Rounded Rectangle with the selected gradient color.


  13. Right-Click on the shape and select Edit Text from the displayed Shortcut Menu.

  14. Type the Button Caption, say Data Files. Highlight the Text and use normal Word Formatting tools viz. Align Center, Bold and Font Color that have better visibility on the Gradient Backgroup.


  15. Note: Once you copy and paste the Button on MS-Access Form you cannot change the Caption or Formatting. You better save and keep the original Buttons in Word Document itself. If you need some changes on the Command Buttons later you can easily do that here, copy and paste it again with changes.



    Button Image with Caption



    You can make copies of this Button and follow Step 5 above onwards to change the Gradient Color and Caption, according to your needs.



    Different Button Images



    Tips:You can change the shape of the created Buttons by selecting Change AutoShape from the Draw Menu on the Drawing Toolbar and select the shape you like the most for a Button.


  16. Right-Click on the Button and select Copy from the Shortcut Menu.

  17. Minimize Word and open your Access Form that you have kept open in Design View.

  18. Right-Click on the Form Detail Section or Footer Section where you want to place the Command Button and select Paste. Drag and position the Button to the correct location.

  19. Right Click on the Button and select Properties from the Shortcut Menu.

  20. Keep the Property Sheet away from the Button (if it is overlapping the Button) and change the Size Mode property to different Modes from Clip to Zoom or Stretch and see how the Button behaves at different Modes.


  21. When the Zoom mode is selected the Button re-sizes itself maintaining the height and width proportions correctly based on the current frame size, but leaves some gap around the image. This background area we can fill up with the background color of the Form so that when the Form opens in Normal View this will not be visible.


  22. If the button is in the Footer Section of your Form then click at the Footer Section of the Form to select it and display the Property Sheet.

  23. Copy the Back Color Property Value of the Form.

  24. Click on the Button to display the Property Sheet of the Button.

  25. Paste the value in Back Color property copied from Form.

  26. Change the Special Effect Property to Raised.

  27. Change the Border Style Property to Transparent.

  28. Now you can program your Colorful Command Button like the normal MS-Access Command Button.


  29. If you look at the Property Sheet of this Command Button you can see that all the essential Properties and Events are available for Programming, using Event Procedures, Hyperlinks, Macros etc.


    I will give you one line of Code to put some life (Animation) into this Button so that it will respond when the mouse moves over it.



  30. Click on the Button’s Mouse Move Property and select Event Procedure. Copy the following Code between the Empty Subroutine lines.



  31. Me.OLEUnbound257.SpecialEffect = 2


  32. Copy the correct name of the Button from its Name Property and paste it replacing OLEUnbound257. See that you are not deleting the dot separaters after the word Me. And at the beginning of .SpecialEffect while pasting the Button Name.


  33. Select the Form’s Section (Detail or Footer or Header) where you have placed the Command Button and display the Property Sheet.

  34. Click on the Mouse Move Property and select Event Procedure, copy and paste the above line of Code with the Button Name change and paste between the empty Subroutine lines.


  35. Change the Value 2 to 1.

Initially the Button will be in a Raised Style. When the mouse is moved over the Button then it will be pushed in (Sunken). When the Mouse is moved out of the Button it will restore back to the Raised state. If you repeat this action in quick succession the Animation will be more evident.


We will learn some more tricks with Command Buttons.


What you think about them?


Office Assistant with Check Box Menu
Msgbox with Options Menu
Who Changed the Data
Progress Counter
Progress Bar on Form

Labels:

5 Comments:

OpenID nromy said…

it does work,

however:

- pls open windows task manager, then click performance tab.

- then go back to the form containing those buttons

- pls drag the mouse-pointer over the form again and again..

- see on windows task manager, u will notice that the CPU usage is getting higher...

because ms access always proceed "on move event" everytime we drag the mouse over the form...

regards
a SAP Lover
romy

January 02, 2009 12:13 PM  
OpenID a sap lover said…

Yes it does work,


however, pls do the following steps:


- pls open windows task manager, then click performance tab.

- then go back to the form containing those buttons

- then pls drag the mouse over the form again and again..

- see on windows task manager, u will notice that the CPU usage is getting higher...
because ms access always proceed "on move event" everytime we drag the mouse over the form...

regards
a SAP Lover

January 02, 2009 12:19 PM  
Blogger a.p.r. pillai said…

Yes, you have a point there. But the Mouse Movements are always monitored by the system and a certain level of increase in CPU usage also noticed when the Mouse is in motion elsewhere.

The statement in question (
Me.OLEUnbound257.SpecialEffect = 2) can be put in test and prevent it from setting the value repeatedly when the value is already set, which will reduce the activity to a certain degree, like:

If
Me.OLEUnbound257.SpecialEffect = 2 then

Me.OLEUnbound257.SpecialEffect = 1

End If

January 02, 2009 4:30 PM  
Anonymous Anonymous said…

I like the ability to add buttons with color to my Access forms. I have noticed one drawback, however, possibly because I have done something wrong.

When colored buttons are created using the Copy/Paste from Word, the buttons on the Access form do not appear in the Tab Sequence. When I run the form in form view, I cannot tab to the buttons, nor can I "click" them using the spacebar or enter key like I can for normal buttons. This is a drawback to my GUI, which is very keyboard intensive.

Have I done something wrong, or is this the correct functionality?

Thanks
GRC

April 29, 2009 11:28 PM  
Blogger a.p.r. pillai said…

This is a known issue that it doesn't have the Tab Order Property. You have done nothing wrong. As an alternative measure you can create a Transparent Command Button (http://www.msaccesstips.com/2008/04/transparent-command-button.shtml) with the same size and place it over the Colorful Comand Button and then you can set the tab order property value of the transparent command button. When you set the Transparent Property of a Normal Command Button to Yes; it becomes transparent or invisible.

Regards,
a.p.r. pillai

May 04, 2009 12:54 PM  

Post a Comment

Note:Comments subject to Review by Blog Author before displaying.

Links to this post:

Create a Link

<< Home


Creative Commons License
Learn MS-Access Tips and Tricks by msaccesstips.com is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 2.5 India License.



This Page is best viewed with 1280 x 1024 Resolution

   FEATURED LINKS
SITEMAP
Command Button Animation
3D Headings on Forms
MsgBox & Office Assistant
Reminder Ticker
MS-Access & E-Mails
Automated E-Mail Alerts
MsgBox with Options Menu
Colorful Command Buttons
Configure Lotus Notes
Alerts through Network
Running this site has become a costly affair as the revenue from Ads is not sufficient to support it. If you find these pages informative & useful and would like to extend a helping hand, then please do it here.





Link Back to us with this Button

Learn MS-Access

Copy and Paste this HTML Code in your Webpage


Add to Technorati Favorites

Programming Blogs - Blog Catalog Blog Directory
Powered by FeedBurner
Add to Google

Software
Computers blogs
TopOfBlogs




AddMe - Search Engine Optimization Submit Your Site Free!
Go BlogZ Ave Blogs
eBlogzilla Changing LINKS
LS Blogs Blogarama
blog search directory BlogUniverse
Find Blogs in Directory RSS Directory
blogskinny.com ShowcaseBlogs.com
Amfibi

Search Engine Optimization and SEO Tools
Dmegs Web Directory Takeaway for Sale Businesses For Sale
Free Submission Directory Free site submission

Free Listing
 





Free Page Rank Checker

AddThis Social Bookmark Button

Enter your email address:

Delivered by FeedBurner



Top Blogs


Microsoft Access is the Jewell among MS-Office suite of Applications. Its Security features are excellent and works fine in Network environment. MS-Access can link/upload data from any Data Source. Applications that you design should be user-friendly and visually pleasing too. Here I would like to share my experience in Microsoft Access Programming with you and I am sure that you will find them interesting too.

My Photo
Name: Ramachandran Pillai
Location: Cochin, India

I am not an Access Guru and not through MS-Access yet. More to learn and I don’t think that aspect has any end because others have their own style of using this tool. We can learn lot more tricks, other than what we already know, from others too. My programming skills in COBOL, BASIC, Turbo-C, dBase, FoxPro, Visual Basic & Basic HTML attained through self-learning. I wrote my first COBOL Program in 1975 for ICL1901, 3rd Generation Main Frame Computer. Worked as a Computer Operator (NCR VRX8555 Mainframe Machine upto 1990) with M/s. Y.B.A. Kanoo, Saudi Arabia. Started using MS-Access Ver.2 in 1996, when dBase III+ and Foxbase (later version Foxpro) were my favorite DBMS. During Last 13 Year period I have developed more than 45 In-House Applications (medium & small) under MS-Access for our Organization, a leading Automotive Company in Oman. All the Applications are fully Secured and runs under Windows Network. It is my pleasure to share my experience with others. Anything interesting that you would like to share with me, please do. My E-mail Address: aprpillai@msaccesstips.com


If you need a Demo of any of the Topic explained here, send me an E-mail to: aprpillai@msaccesstips.com
with the Topic Description, I shall try to send a sample database to you.


Access Tips | Email | Reports | Report Tricks | Graphs | Forms | Menus | Animation | Security | Internet | How TOs | Linking | Query | Progress Meter | Alerts | Process Tips | Access Functions |




Site Designed by:www.msaccesstips.com