Learn Microsoft Access Advanced Programming Techniques, Tips and Tricks.

Label Animation Variant

Introduction.

I have several label animation styles lined up to share with you, and we have already explored two of them in the last two articles:

  1. Label Animation Style-1
  2. Label Animation Style-2

In this lesson, we will explore two variations of the animation method we practiced last week. If you have already followed the steps for creating the sample labels and writing the program, you can reuse the same setup with only a few small adjustments.

The only change needed is in the position of the second label (lbl2). The arrangement of labels from the previous animation method is shown below:

In this method, both labels are initially placed apart and then move toward each other until they meet at the final position, forming the 3D heading style.

If you prefer a variation with a stronger visual appeal, you can reduce the distance between the two labels and place them slightly closer together. This adjustment gives the animation a smoother and more polished effect.

The modified version of the design is shown below:

You can implement this variant of the earlier animation style by changing the Properties of the lbl2 label as given below. 

The Design Change.

  1. Make a copy of the Employees Form with the earlier animation method and change the Form name to something like Employee2_1 or any other name you prefer.

  2. Open the Employee2_1 in Design View.

  3. Click on lbl2 (the label with the White-colored label and display its Property Sheet (View -> Properties).

  4. Change the Property Values as shown below. The only change that you need to make is the left Property value only. But, the full Property Values are reproduced here with the change in the Left Property:

    • Width = 2.9924
    • Height = 0.3549
    • Top = 0.125
    • Left = 3.6354
    • Back Style = Transparent
    • Border Style = Transparent
    • Font Name = Verdana
    • Font Size = 18
    • Text Align = Center
    • Font Weight = Bold
    • ForeColor = #FFFFFF

    Once you make the Left Property Value change, the label will move into place as shown in the second image above.

  5. Display the Code Module of the Form (View -> Code) while the Employee2_1 Form is still in the design view.

  6. Copy and paste the following modified Code into the Form Module, overwriting the existing VBA Code.

    The Form Module VBA Code.

    Option Compare Database
    Option Explicit
    'Global declarations
    Private Const twips As Long = 1440
    Dim i, j
    
    Private Sub Form_Current()
    Dim txtName As String
    Me.lbl1.Left = 2.5194 * twips
    Me.lbl1.Top = 0.1569 * twips
    Me.lbl1.Width = 2.9924 * twips
    Me.lbl1.Height = 0.3549 * twips
    
    Me.lbl2.Left = 3.6354 * twips
    Me.lbl2.Top = 0.125 * twips
    Me.lbl2.Width = 2.9924 * twips
    Me.lbl2.Height = 0.3549 * twips
    
    txtName = UCase(Me![first name] & " " & Me![Last name])
    Me.lbl1.Caption = txtName
    Me.lbl2.Caption = txtName
    i = 0
    Me.TimerInterval = 25
    
    End Sub
    
    Private Sub Form_Timer()
    Dim m, L1, L2
    i = i + 1
    m = i Mod 2
    Select Case m
        Case 1
            L1 = Me.lbl1.Left
            L1 = L1 + (0.084 * twips)
            Me.lbl1.Left = L1
        Case 0
            L2 = Me.lbl2.Left
            L2 = L2 - (0.084 * twips)
            Me.lbl2.Left = L2
    End Select
    DoEvents
    If i > 12 Then
       Me.TimerInterval = 0
       i = 0
    End If
            
    End Sub
  7. Save the Form and open it in Normal View.

  8. Move the Employee Records forward using the record navigation buttons and watch the refined animation of employee names.

I hope you like the overall impact of the change in the earlier animation method.

The Design Changes.

We will look into another variant of the same animation method with the following design change:

  1. In this method, the label  lbl2 is placed below lbl1. Both labels are then gradually moved toward each other until they overlap in a way that they create a 3D-style header.

  2. Make a Copy of the Employee2_1 Form and save it with the name Employee2_2.

  3. Open the Form in Design View.

  4. Click on the label with the White-colored text (with the Name Property Value lbl2) to select it.

  5. Display the Property Sheet (View -> Properties) and change the following Property Values as shown below:

    • Width = 2.9924
    • Height = 0.3549
    • Top = 0.5313
    • Left = 2.5729
    • Back Style = Transparent
    • Border Style = Transparent
    • Font Name = Verdana
    • Font Size = 18
    • Text Align = Center
    • Font Weight = Bold
    • ForeColor = #FFFFFF
  6. Display the Code Module of the Form (View ->Code).

  7. Copy and paste the following Code into the Form VBA Module, overwriting the existing Code.

    The Form Module Code.

    Option Compare Database
    Option Explicit
    
    Private Const twips As Long = 1440
    Dim i, j
    
    
    Private Sub Form_Current()
    Dim txtName As String
    Me.lbl1.Left = 2.5521 * twips
    Me.lbl1.Top = 0.1569 * twips
    Me.lbl1.Width = 2.9924 * twips
    Me.lbl1.Height = 0.3549 * twips
    
    Me.lbl2.Left = 2.5729 * twips
    Me.lbl2.Top = 0.5313 * twips
    Me.lbl2.Width = 2.9924 * twips
    Me.lbl2.Height = 0.3549 * twips
    
    txtName = Me![first name] & " " & Me![Last name]
    Me.lbl1.Caption = txtName
    Me.lbl2.Caption = txtName
    i = 0
    Me.TimerInterval = 50
    
    End Sub
    
    Private Sub Form_Timer()
    Dim m, L1, L2
    i = i + 1
    m = i Mod 2
    Select Case m
        Case 0
            L1 = Me.lbl1.Top
            L1 = L1 + (0.084 * twips)
            Me.lbl1.Top = L1
        Case 1
            L2 = Me.lbl2.Top
            L2 = L2 - (0.084 * twips)
            Me.lbl2.Top = L2
    End Select
    DoEvents
    If i > 4 Then
       Me.TimerInterval = 0
       i = 0
    End If
            
    End Sub
    
    
  8. Save the Form and open it in Normal View.

  9. Move the employee records forward using the Record Navigation buttons and observe how the new animation method is applied in the same 3D style.

Next week we will learn a different and interesting style of the label animation method.

  1. Textbox and Label Inner Margins
  2. Animating Label on Search Success
  3. Label Animation Style-1
  4. Label Animation Style-2
  5. Label Animation Variant
  6. Label Animation Zoom-in Style
  7. Label Animation in Colors
  8. Label Animation Zoom-out Fade
Share:

1 comment:

  1. [...] This post was mentioned on Twitter by aprpillai. aprpillai said: Label Animation Variant: I have several Label Animations Styles in store for you and we have… http://goo.gl/fb/MH31a [...]

    ReplyDelete

Comments subject to moderation before publishing.

PRESENTATION: ACCESS USER GROUPS (EUROPE)

Translate

PageRank

Post Feed


Search

Popular Posts

Blog Archive

Powered by Blogger.

Labels

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