Link to home
Start Free TrialLog in
Avatar of Patrick O'Dea
Patrick O'DeaFlag for Ireland

asked on

Automating my help text for a datasheet

following on from an earlier question ....

Private Sub SellingPrice_GotFocus()
Me.Parent.HelpTextForField = Me.SellingPrice.Tag
End Sub

Open in new window


This code is used in every field in my datasheet and displays "help" text that is held in the "tag".

I would like to automate a little further as follows;
1. Setup a new tblHelpUsers with two fields ; [Control_Name], [HelpText]
2. So, when the control is in focus I simple call a function "DisplayHelp"
3. The function will KNOW the controlname and set my  Me.Parent.HelpTextForField to [tblHelpUsers].[HelpText] as per the original VBA
4. Obviously I will no longer use the "tag" to hold help text.

What line should I put in my function to achieve the above?

Al contributions appreciated.
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
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
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 Patrick O'Dea

ASKER

Scott,

Your suggestion is work well ... but ...

Me.Name is displaying the form name (I want the control name)

I suspect that this may be because my datasheet is held as a subfolder within another folder.

QUESTION: Is there a better way to reference the actual control?
Got it ;

Screen.ActiveControl.Name
Thanks folks,

That works perfectly!

(Comments noted, Pat)