<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
Saturday, September 09, 2006

COMMAND-BUTTON ANIMATION

Sample image

Microsoft Access (the Relational Database Management System), is the Jewell among Ms-Office Suite of Applications, comes with superior Designing Tools and with built-in Visual Basic Language. These Pages are not intended for Beginner’s Tutorial Lessons but for those who have at least some basic knowledge of Designing MS-Access Tables, Queries, Forms, Reports, Macros and have general understanding of Visual Basic (the Programming Language of all MS-Office Applications) Modules, Function Procedures, Event Procedures etc.

When we develop an Application under any Database Management System it should be User-friendly and visually pleasing too. An un-attractive design spoils the appeal of the whole Project and it reflects the developer’s lack of creativity and indirectly reflects his inability to approach data processing problems effectively as well.

You can cook good food in the Kitchen but if the final presentation on the Table is bad then all the efforts put behind the scene doesn’t get the attention that it deserves. Like the saying goes, “face is the mirror of mind”, attractively designed Screens and Reports definitely have an appeal to the Users.

Here, I would like to present some of the Controls and Programs that I have developed to use in my Projects and I am sure that you will find them interesting too. Example Codes are written for MS-Access 2000 and will run under later versions too.

First, ensure that the essential Reference Library Files are attached to your Project. Display the Visual Basic Editor Window. Select Visual Basic Editor Option from Tools Menu or Code from View Menu. On the Visual Basic Editor Window Select References… from Tools Menu. Put check mark on the following Library Files in the Available References Dialogue Control:


  1. Visual Basic for Applications
  2. Microsoft Access 11.0 Object Library
  3. OLE Automation
  4. Microsoft DAO 3.6 Object Library
  5. Microsoft ActiveX Data Objects 2.5 Library
  6. Microsoft Office 11.0 Object Library
  7. Microsoft Visual Basic for Applications Extensibility 5.3



The Version Numbers of Library Files will be different based on what MS-Office version you are using. The Library File's List will be in alphabetical order. After you put check marks all the selected items will appear in the list on the top.

When the Mouse is passed over the Command Button it will move up a little to the left showing up its shadow underneath and when Mouse is moved over the blank area of the Form the Command Button goes back into its original state. When this action is repeated the Button gives a lively appearance responding to the User's mouse movements over it.

Copy and paste the following Code into a New Global Module:



Public Function ButtonAnimate(ByVal strForm As String, _
ByVal mode As Integer, ByVal lblName As String)
'------------------------------------------------------------
'Command Button Animation
'Author : a.p.r. pillai
'Date : September 2006
'------------------------------------------------------------
Dim FRM As Form, l As Long, t As Long

On Error GoTo ButtonAnimate_Err

Set FRM = Forms(strForm)

l = FRM.Controls(lblName & "Box").Left
t = FRM.Controls(lblName & "Box").Top

If (mode = 1) And (FRM.Controls(lblName &  _
"Box").Visible = False) Then
   FRM.Controls(lblName & "Box").Visible = True
   FRM.Controls(lblName).Left = l - (0.0208 * 1440)' 0.0208 inches
   FRM.Controls(lblName).Top = t - (0.0208 * 1440)' 0.0208 inches
   FRM.Controls(lblName).FontWeight = 700
ElseIf (mode = 0) And (FRM.Controls(lblName & "Box").Visible = True) Then
   FRM.Controls(lblName & "Box").Visible = False
   FRM.Controls(lblName).Left = l
   FRM.Controls(lblName).Top = t
   FRM.Controls(lblName).FontWeight = 400
End If

ButtonAnimate_Exit:
Exit Function

ButtonAnimate_Err:
'Err.Clear

Resume ButtonAnimate_Exit
End Function


NB:All object specifications in this site are in U.S. measurements.
Those who follow Metric System please convert the values or change the Regional Settings into U.S. on Control Panel.

Command Button Design:
Command Button image

1.
Create a Command Button on the Footer Section of a Form

2. Display the Property Sheet of the Command Button and change the following Properties:


Name = cmdClose
Caption = Close
ControlTipText = Click


3. Create a Rectangle Control on the Footer of the Form slightly smaller by Height and Width of the Command Button so that when the Command Button is placed over the Rectangle Control it completely hides it. Change the following properties of the Rectangle Control:

Name = cmdCloseBox

Note : The Rectangle Control's Name must be exactly the same Name of the Command Button with the 'Box' suffix.


Visible = False
SpecialEffect = Shadowed
BorderColor = 0
BorderStyle = Solid
BackStyle = Transparent


4. Drag the Rectangle control correctly underneath the Command Button. You can use Ctrl-Key with Arrow Buttons in MS-Access 2000 or Arrow Keys in later Versions to move the Control precisely under the Command Button. The Rectangle control will not be visible when correctly placed underneath the Command Button. If necessary, click the Send-to-Back Toolbar Button (or Select Send-to-Back from the Format Menu) if the Rectangle Control is overlapping the Command Button.

5. Copy and paste the following Code into the Form’s Visual Basic Module and save the Form.

Private Sub cmdClose_MouseMove(Button as Integer, _
Shift as Integer, X as Single, Y as single)

ButtonAnimate Me.Name, 1, "cmdClose"

End Sub


Private Sub FormFooter_MouseMove(Button as Integer, _
Shift As Integer, X As Single, Y As Single)

ButtonAnimate Me.Name, 0, "cmdClose"

End Sub


Open the Form in Normal View and try moving the Mouse over the Command Button and over the blank area of the Form Footer in a continuous stroke. When the Mouse is over the Button the Button moves slightly up and to the left showing up the Rectangle Frame as if it is the shadow of the Command Button and when the Mouse is dragged over the blank area of the Form Footer the Button goes back to its original state hiding the shadow. When this action is repeated the Button becomes lively and responds to the User every time the mouse is passed over the Button.

Any Number of Command Buttons can be added this way at the Form Footer (or Form Header Section, Detail Section) by placing the code for MouseMove Events. When the ButtonAnimate() Function is called, the Function Parameter Value 1 moves the Button up and 0 brings it back to its original position. If more than One button is added at the Footer, each Button should have its own Call to the ButtonAnimate() Function with 1 & 0 Values at the Command Button & Form Footer MouseMove Event Procedures respectively. --oOo--




Download Demo

Database





Next >> Create 3D Text Headings on Forms and Reports

Labels:

0 Comments:

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