Learn Microsoft Access Advanced Programming Techniques, Tips and Tricks.

Label Animation Variant

Introduction.

I have several Label Animation Styles in store for you and we have already seen two of them through the last two Articles:

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

Here, we will examine two variants of the animation method we tried last week. If you have gone through the procedures for creating the sample labels and programs, then we can try the same animation method with slightly different settings for the labels.

The change is required only on the position of the second label lbl2. The arrangement of labels of the last animation method is given below:

Both labels are placed apart and moved towards each other before they are positioned on the final destination to form the 3D Heading Style.

If you think it is better if the distance of both labels is reduced and place them a little bit closer so that the animation style has a better appeal then here it is for you to try it. 

The modified version of the above design is given 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 over-writing 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:

In this method, we place lbl2 named label below lbl1 and slowly move them towards each other and place them in such a way that they form into a 3D header.

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

  2. Open the Form in Design View.

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

  4. 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
  5. Display the Code Module of the Form (View- ->Code).

  6. Copy and Paste the following Code into the Form VBA Module over-writing 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
    
    
  7. Save the Form and open it in normal View.

  8. Try moving the Employee records forward and watch the new method of the same style of animation.

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