Home  |  About  |   Search   

What's New
Table Of Contents
Credits
Netiquette
10 Commandments 
Bugs
Tables
Queries
Forms
Reports
Modules
APIs
Strings
Date/Time
General
Downloads
Resources
Search
Feedback
mvps.org

RunCommand Constants

Terms of Use


 

Forms: OnMouseOver Effect

Author(s)
Dev Ashish

(Q)    How can I create a OnMouseOver effect on Access forms?

(A)    The equivalent Access form event is OnMouseMove.  We can call a function to show the desired effect and then from the surrounding section's OnMouseMove event, call a function to remove the effect.

    For each label on a form, place a call to function fSetFontBold from their OnMouseMove event and pass the label's name as an argument to the function.

[OnMouseMove]    = fSetFontBold("lblThisLabel")

From the OnMouseMove event of the surrounding detail section, call the function fRemoveFontBold.

[OnMouseMove]    = fRemoveFontBold()

Create a form level variable.

Dim mstPrevControl As String

'**************** Code Start *************
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
Function fSetFontBold(stControlName As String)
Const cBold = 700
Const cNormal = 400
    On Error Resume Next
    With Me(mstPrevControl)
        .FontWeight = cNormal
        .ForeColor = 1279872587
    End With
    mstPrevControl = stControlName
    With Me(stControlName)
        .FontWeight = cBold
        .ForeColor = 0
    End With
End Function

Function fRemoveFontBold()
Const cNormal = 400
    On Error Resume Next
    With Me(mstPrevControl)
        .FontWeight = cNormal
        .ForeColor = 1279872587
    End With
End Function
'***************** Code End ****************

1998-2009, Dev Ashish & Arvin Meyer, All rights reserved. Optimized for Microsoft Internet Explorer