Link to home
Start Free TrialLog in
Avatar of sstampf
sstampfFlag for India

asked on

Modify/Add Control Tip (ToolTip) for Access Forms using VBA

I have an access form which has many controls. I want to assign a ControlTip for all of them so that when the user hovers his mouse over the control he is able to see information regarding how to use that control. I have that information stored in a seperate table where I have the ControlName and against it I have its description.

Table Name is tblDataDictionary and the Field/Column in which ControlName is stored is named as "Data Element Name" and the column/field where the Description is stored is named "Data Description"

The number of controls are so many that it is not possible for me to perform this task manually. Please help.

Thanks
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

are you adding the Data description in the ControlTip Text property of the controls?
Avatar of sstampf

ASKER

Yes
SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sstampf

ASKER

Many thanks. I modified the code a bit (to suit my needs) and it worked perfectly.
Sub addToolTip()
Dim ctl As Control
 
DoCmd.OpenForm "frmEmpDetailsMain", acDesign, , , , acHidden
For Each ctl In Forms!frmEmpDetailsMain.Controls
If ctl.ControlType = acTextBox Or ctl.ControlType = acComboBox Or ctl.ControlType = acCheckBox Then
    ctl.ControlTipText = Left(Nz(DLookup("[Data Description]", "tblDataDictionary", "[Data Element Name]='" & ctl.Name & "'"), ""), 254)
End If
Next
 
DoCmd.Close acForm, "frmEmpDetailsMain", acSaveYes
 
End Sub

Open in new window