Learn Microsoft Access Advanced Programming Techniques, Tips and Tricks.

Label Animation Zoom-in Style

This week we will learn a different style of Label Animation technique. Those who would like to have a look at the earlier simple label animation methods, the page links are given below to visit those pages:

In all the above methods we have used two labels, which moved towards each other from different directions and placed close together to form the displaying text to look like a 3D heading.

This week we will use a different approach and we need about twenty small labels placed close together horizontally. Each Label will display only one character of the Employee Name and all the employee names are less than twenty characters only.

Sample arrangement of Labels in the design view is given below:

Animation Style image is given below:

The employee name will appear from left to right, character by character in each label, followed by the  letters will Zoom-in and Zoom-out in sequence. The above screen is captured in the middle of that action.

Let us get into the design task of this animation.

  1. If you have not gone through the earlier examples then Import the Employees Table from C:\Program Files\Microsoft Office\Office11\Samples\Northwind.mdb sample database.
  2. Click on the Employees Table and select Form from Insert Menu.
  3. Create a Form as shown above and save it with the name Employees or any suitable name that you prefer.
  4. Open the Form in Design View.
  5. Select the Label Tool from Toolbox and draw a Label control in the header section of the Form.
  6. Change the following property values of the Label as given below:
    • Name = lbl01
    • Width = 0.2528"
    • Height = 0.3549"
    • Top = 0.1563"
    • Left = 1.1146
    • Back Style = Transparent
    • Border Style = Transparent
    • Special Effect = Flat
    • Font Name = Verdana
    • Font Size = 14
    • Font Weight = Bold
    • Fore Color = 7500402

    Now, we must copy this label nineteen times and arrange them as shown on the first image, at the top of this page.

  7. We must also change the Name Property Value of each label sequentially so that we can easily address each label in Programs to change their caption values to display the Employee's name.
  8. Right-Click on the Label and select Copy from the displayed Shortcut Menu.
  9. Select Paste from Edit Menu to create a copy of the Label.
  10. Click and drag the new label and place it to the right of the first label. Don't worry about the misalignment of the labels, we will arrange them easily later.
  11. Repeat the Paste action to create another eighteen labels.
  12. The Labels will appear automatically to the right of earlier labels.

  13. Click on the second Label.
  14. Display its Property Sheet (View- -> Properties).
  15. Change the Name Property value to lbl02.
  16. Repeat this method for other labels also and name them as lbl03, lbl04 and so on up to lbl20.
  17. Click at the left side of the first label (lbl01) and drag the Mouse over all the twenty labels to select them all together.
  18. Select Format - -> Align - -> Top to align all Labels horizontally.
  19. Select Format - -> Align - -> Left to bring all the Labels close together.

    Now, that we have arranged the labels and their Name Property Values set to lbl01 to lbl20 all that is left to do is to copy the following Programs into the Form's Code Module.

  20. Select Code from View Menu.
  21. Copy and Paste the following VBA Code into the Module (overwriting the existing VBA Code, if any).
    Option Compare Database
    Option Explicit
    Private Const twips As Long = 1440
    Dim i, j, txtName, ctrl As Label
    Private Sub Form_Current()
    txtName = UCase(Me![first name] & " " & Me![Last name])
    i = 0
    Me.TimerInterval = 50
    End Sub
    Private Sub Form_Timer()
    Dim m, L1, L2
    i = i + 1
    If i > Len(txtName) Then
       For j = Len(txtName) + 1 To 20
        Set ctrl = Me("lbl" & Format(j, "00"))
        ctrl.Caption = ""
       Me.TimerInterval = 0
       i = 0
       Set ctrl = Me("lbl" & Format(i, "00"))
       ctrl.Caption = Mid(txtName, i, 1)
       ctrl.ForeColor = &H727272
    End If
    End Sub
    Public Function animate()
    Dim k As Integer, t
    For k = 1 To Len(txtName)
      Set ctrl = Me("lbl" & Format(k, "00"))
      ctrl.ForeColor = 0
      ctrl.FontSize = 24
      If k = 10 Then Exit For
      t = Timer
      Do While Timer < t + 0.09
      ctrl.FontSize = 14
    End Function
  22. Save the Form with the Code.
  23. Open it in normal view.
  24. Use the Record Navigation Buttons to advance the record one by one forward/back to display the employee name animated.

Hope you like this method better and implement it in your Projects.


1 comment:

  1. [...] This post was mentioned on Twitter by aprpillai. aprpillai said: Label Animation Zoom-in Style: This week we will learn a different style of Label Animation… http://goo.gl/fb/RvFPT [...]



Your email address:

Delivered by FeedBurner


Infolinks Text Ads

blog.feedspot.com Microsoft Access Blogs

Popular Posts

Search This Blog

Blog Archive

Powered by Blogger.


Forms How Tos Functions MS-Access Security Reports msaccess forms Animations msaccess animation Utilities msaccess controls Access and Internet MS-Access Scurity MS-Access and Internet Queries External Links msaccess reports msaccess tips Accesstips Menus and Toolbars MsaccessLinks Process Controls Art Work Downloads msaccess How Tos Graph Charts msaccessQuery Array List Boxes Command Buttons Emails and Alerts Property Query Class Module Combo Boxes Custom Wizards DOS Commands Data Data Type Objects VBA ms-access functions msaccess functions msaccess graphs msaccess reporttricks Calculation msaccessprocess security advanced Access Security Custom Functions Field Type Macros Menus Object Reference Report Top Values Variables msaccess email msaccess menus progressmeter Access2007 Auto-Number Command Button Copy Expression Fields Form Form Instances Join Methods Microsoft Numbering System Records Recordset Security Split SubForm Table Utility Workgroup database msaccess wizards Access2003 Accounting Year Action Animation Attachment Binary Numbers Bookmarks Budgeting ChDir Color Palette Conditional Formatting Controls Data Filtering Defining Pages Diagram Disk Dynamic Lookup Error Handler Excel Export External Filter Formatting Groups Hexadecimal Numbers Import Labels List Logo Macro Mail Merge Main Form Memo Monitoring Octal Numbers Operating System Paste Primary-Key Product Rank Reading Rich Text Sequence SetFocus Summary Tab-Page Tables Time Difference Union Query User Users Water-Mark Word automatically commands function hyperlinks iSeries Date iif ms-access msaccess msaccess alerts pdf files reference restore switch text toolbar tutorial updating upload vba code

Featured Post

Access Class Module and Wrapper Classes

There are times that a particular Class Module needs to be instantiated more than once, to use similar set of values for a particular Applic...


Blog Archive

Recent Posts