sstampf
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
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
are you adding the Data description in the ControlTip Text property of the controls?
ASKER
Yes
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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