Learn Microsoft Access Advanced Programming Techniques, Tips and Tricks.

Label Animation Style-1

Introduction

A Form with lively Objects like Animated Command Buttons, Animated GIFs, Moving Text, etc., makes it more interesting for the User to work with MS-Access Applications.  MS-Access doesn't have any of those things built-in or ready-made to use quickly. Our imagination and ingenuity is the only tool available to create something with the existing, strictly for business-like features in MS-Access.

After working with MS-Access for some time I got bored with the repeated use of the same objects without any changes for designing the Applications.  I wanted to make something more eye-catching to kill the boredom. As the saying goes "Necessity is the father of inventions", I have developed some interesting features like Command Button Animation, Animated Floating Calendar, usage of Office Assistant in MsgBoxes, Animating Label on search success, Reminder Ticker, and others.

Today we will learn a simple Label Animation Technique with an example in the Employees Form from the Northwind.mdb sample database.

  1. Import the following objects from the Northwind sample database.:

    • Table: Employees
    • Form: Employees

    If you open the Employees Form in Normal View you can see that the Employee's; Name; Firstname and Lastname joined together; is displayed in the Header of the Form in a Text Box. When you make some other record current on Form the employee's full name changes on the Form Header Textbox as well.

    We will add some animated effect to this and make the employee name appear slowly from the right edge of the label to the left, character by character, and move into place.

  2. Open the Employees Form in Design View.

  3. Delete the existing TextBox that displays the Employee's Name.

  4. Create a Label on the Header of the Form.

  5. Display the Property Sheet (View - -> Properties) of the Label and change the following Property Values:

    • Name = lbl1
    • Width = 3.5"
    • Height =0.32"
    • Back Style = Transparent
    • Border Style = Transparent
    • ForeColor = 16777215
    • Font Name = Times New Roman
    • Font Size = 18
    • Font Weight = Bold
    • Text Align = Right
  6. Display the Code Module of the Form (View - ->Code).

  7. Press Ctrl+A to highlight the existing VBA Routines and press the Del key to delete them.

  8. Copy the following VBA Code and paste it into the Code Module of the Form.

    Label Animation Code.

    Option Compare Database
    Option Explicit
    
    Dim txt1 As String, txtlen As Integer
    Dim j As Integer, txt2 As String
    
    Private Sub Form_Timer()
    j = j + 1
    If j <= txtlen Then
      txt2 = Left(txt1, j)
      Me.lbl1.Caption = txt2
      'Me.lbl2.Caption = txt2
      Else
      Me.TimerInterval = 0
    End If
    
    End Sub
    
    
    Private Sub Form_current()
           
    txt1 = UCase(Me![FirstName] & " " & Me![LastName])
    txtlen = Len(txt1)
    j = 0
    Me.TimerInterval = 50
    
    End Sub
  9. Save and Close the Employees Form.

  10. Open the Employees Form in the normal view.

  11. When you open the Form you will find the Employee Name is moving into place slowly from right to left, character by character, in the header label.

  12. Click on the Navigation button to move the records forward one by one.
  13. The names of the employees will be displayed in the same style by moving from the right edge of the label to the left.

Fancy Work to the Label.

We will add little fancy work to the Employee Name with a three-dimensional backlit effect by copying the Label and placing it over the existing one. See the finished design of the image is given below:

  1. Open the Employee Form in Design View.

  2. Select the header label.

  3. Click on the Copy, Paste ToolBar buttons to make a copy of the label (or select Copy, Paste Options from the View Menu).

  4. Click on the new Label to select it, if it is not in the selected state.

  5. Display the Property Sheet of the Label (View - ->Properties).

  6. Change the following Property Values as shown below:

    • Name = lbl2
    • ForeColor = 128
  7. Move the label up and over the first label and place it slightly down from the top edge of the first label and to the left, about the thickness of a hair.  The sample image design view is given below:

  8. I have already included the line of code necessary to run this trick.  All you have to do is to enable that line in the VBA code, do the following:

  9. While the Form is still in design view display the VBA Module (View - ->Code)

  10. You will find the following line of code in the Sub Form_Timer() Event Procedure in a different color (most probably in green color):

  11. 'Me.lbl2.Caption = txt2

  12. Find the ' (single quote) character at the beginning of this line and delete it.

  13. Save and Close the Form.

  14. Open the Form in the Normal View.

    Now you will find the Employee Names appearing in animated characters, with the 3D effect, as shown in the second image above.

  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 is my first time visit to your blog and I am very interested in the articles that you serve. Provide enough knowledge for me. Thank you for sharing useful and don't forget, keep sharing useful info: อนิเมะ An animation is defined as a visual change in a scene with respect to time.

    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