In the previous post Simple Microsoft Access MouseOver and MouseOut Events the only type of control monitored was the CommandButton. This expands on the same idea but extends this to the major form controls. It still does not handle where controls are close to each other or overlapped, as the MouseOut event will only be fired when then the mouse moves over the form, or rather detail section of the form.

'----------------------------------------------------------------
' Module    : clsMouseOver
' Author    : Brileigh Computer Services (c) 2012
' Purpose   : Create a simple MouseOver and MouseOut trappable
'             event, for most of the major form controls
'
'----------------------------------------------------------------
 
Option Compare Database
Option Explicit
 
Private WithEvents oForm As Access.Form
Private WithEvents oDetail As Access.Section
 
' In this example the target is a CommandButton
' but can be any Control that supports MouseMove events
 
Public Event MouseOut()
Public Event MouseOver()
 
Private m_boolLastMouseIsOver As Boolean
 
Private Const EVENTED As String = "[Event Procedure]"
Private m_col_BackgroundControls As Collection

'---------------------------------------------------------------------------------------
' You cannot generically set up an object such as
' Private WithEvents oControl As Access.Control
' as you will get an error that the
' Object does not source automation events
' so we need objects that will
Private WithEvents oTextBox As Access.TextBox
Private WithEvents oCombo As Access.ComboBox
Private WithEvents oButton As Access.CommandButton
Private WithEvents oRectangle As Access.Rectangle
Private WithEvents oTC As Access.TabControl
Private WithEvents oTCP As Access.Page
Private WithEvents oLabel As Access.Label
Private WithEvents oOptionGroup As Access.OptionGroup
Private WithEvents oOption As Access.OptionButton
Private WithEvents oCheckBox As Access.CheckBox
Private WithEvents oListBox As Access.ListBox
Private WithEvents oImage As Access.Image
Private WithEvents oCustomControl As Access.CustomControl ' activeX control
Private WithEvents oBoundObjectFrame As Access.BoundObjectFrame
Private WithEvents oObjectFrame As Access.ObjectFrame
Private Sub Class_Initialize()
Set m_col_BackgroundControls = New Collection
End Sub

Private Sub Class_Terminate()
    Set oForm = Nothing
    Set oCombo = Nothing
    Set oButton = Nothing
    Set oTC = Nothing
    Set oRectangle = Nothing
    Set oTCP = Nothing
    Set oLabel = Nothing
    Set oOptionGroup = Nothing
    Set oOption = Nothing
    Set oCheckBox = Nothing
    Set oListBox = Nothing
    Set oImage = Nothing
    Set oCustomControl = Nothing
    Set oBoundObjectFrame = Nothing
    Set oObjectFrame = Nothing
End Sub
 
 
Public Property Set Form(objForm As Access.Form)
    ' Setup the MouseMove for the surrounding object to the
    'TargetControl, in this case the Detail Section but
    'could be an overlapped control, a tab page, or a footer
    Set oForm = objForm
    Set oDetail = objForm.Section("Detail")
    oDetail.OnMouseMove = EVENTED
End Property
 
'---------------------------------------------------------------------------------------
' Procedure : TargetControl
' Purpose   : Sets a reference to the Control
'             you will to monitor MouseOver and MouseOut
'             and create an event handler for its
'             MouseMove event
' Parameters: generic Form Control
' Returns   : Set s typed Form Control
'---------------------------------------------------------------------------------------
'
Public Property Set TargetControl(oCtl As Control)
    If TypeOf oCtl Is Access.TextBox Then
        Set oTextBox = oCtl
        oTextBox.OnMouseMove = EVENTED
    ElseIf TypeOf oCtl Is Access.ComboBox Then
        Set oCombo = oCtl
        oCombo.OnMouseMove = EVENTED
    ElseIf TypeOf oCtl Is Access.CommandButton Then
        Set oButton = oCtl
        oButton.OnMouseMove = EVENTED
    ElseIf TypeOf oCtl Is Access.Rectangle Then
        Set oRectangle = oCtl
        oRectangle.OnMouseMove = EVENTED
    ElseIf TypeOf oCtl Is Access.TabControl Then
        Set oTC = oCtl
        oTC.OnMouseMove = EVENTED
    ElseIf TypeOf oCtl Is Access.Page Then
        Set oTCP = oCtl
        oTCP.OnMouseMove = EVENTED
    ElseIf TypeOf oCtl Is Access.Label Then
        Set oLabel = oCtl
        oLabel.OnMouseMove = EVENTED
    ElseIf TypeOf oCtl Is Access.OptionGroup Then
        Set oOptionGroup = oCtl
        oOptionGroup.OnMouseMove = EVENTED
    ElseIf TypeOf oCtl Is Access.OptionButton Then
        Set oOption = oCtl
        oOption.OnMouseMove = EVENTED
    ElseIf TypeOf oCtl Is Access.CheckBox Then
        Set oCheckBox = oCtl
        oCheckBox.OnMouseMove = EVENTED
    ElseIf TypeOf oCtl Is Access.ListBox Then
        Set oListBox = oCtl
        oListBox.OnMouseMove = EVENTED
    ElseIf TypeOf oCtl Is Access.Image Then
        Set oImage = oCtl
        oImage.OnMouseMove = EVENTED
    ElseIf TypeOf oCtl Is Access.CustomControl Then
        Set oCustomControl = oCtl
        oCustomControl.OnMouseMove = EVENTED
    ElseIf TypeOf oCtl Is Access.BoundObjectFrame Then
        Set oBoundObjectFrame = oCtl
        oBoundObjectFrame.OnMouseMove = EVENTED
    ElseIf TypeOf oCtl Is Access.ObjectFrame Then
        Set oObjectFrame = oCtl
        oObjectFrame.OnMouseMove = EVENTED
    End If
End Property
 
'---------------------------------------------------------------------------------------
' The events handlers for each of the control types
' to be mionitored
'---------------------------------------------------------------------------------------
'
Private Sub oTextBox_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ControlsMouseMoveOverHandler
End Sub

Private Sub oCombo_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ControlsMouseMoveOverHandler
End Sub

Private Sub oButton_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ControlsMouseMoveOverHandler
End Sub

Private Sub oRectangle_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ControlsMouseMoveOverHandler
End Sub

Private Sub oTC_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ControlsMouseMoveOverHandler
End Sub

Private Sub oLabel_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ControlsMouseMoveOverHandler
End Sub

Private Sub oOptionGroup_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ControlsMouseMoveOverHandler
End Sub

Private Sub oOption_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ControlsMouseMoveOverHandler
End Sub

Private Sub oCheckBox_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ControlsMouseMoveOverHandler
End Sub

Private Sub oListBox_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ControlsMouseMoveOverHandler
End Sub

Private Sub oImage_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ControlsMouseMoveOverHandler
End Sub

Private Sub oCustomControl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ControlsMouseMoveOverHandler
End Sub

Private Sub oBoundObjectFrame_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ControlsMouseMoveOverHandler
End Sub

Private Sub oObjectFrame_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ControlsMouseMoveOverHandler
End Sub

'---------------------------------------------------------------------------------------
' Procedure : ControlsMouseMoveOverHandler
' Purpose   : To trigger (Raise) just One MouseOver event
'             when the mouse moves over the control
'---------------------------------------------------------------------------------------
'
Private Sub ControlsMouseMoveOverHandler()
    If Not m_boolLastMouseIsOver Then
        m_boolLastMouseIsOver = True
        RaiseEvent MouseOver
    End If
End Sub

'---------------------------------------------------------------------------------------
' Procedure : oDetail_MouseMove
' Purpose   : To trigger (Raise) just one MouseOut event
'             when the mouse moves out of the control and
'             onto the background. If the background is not
'             the Detail section then it will need
'             modification,
'---------------------------------------------------------------------------------------
'
Private Sub oDetail_MouseMove(Button As Integer, _
                                  Shift As Integer, _
                                  X As Single, _
                                  Y As Single)
    If m_boolLastMouseIsOver Then
        m_boolLastMouseIsOver = False
        RaiseEvent MouseOut
    End If
End Sub


I am sure there are better ways to do this, and to overcome the problems of overlapped or close together controls.