G
Guest
Wotcha,
Situation: Access form with a profusion (some might even say a cornucopia)
of text labels (which appear as hyperlinks thanks to the simple trick of just
putting a space in the hyperlink address property - thanks to someone else
for that one). When the user clicks one of these labels, a popup form which
displays various helpful comments from yours truly to help the poor sap fill
out a tax return. The onclick function looks like this:
Private Sub lblHelpDonationsToExemptOrganisations_Click()
displayHelp Replace("lblHelpDonationsToExemptOrganisations_Click", "_Click",
"")
End Sub
and the function it calls, displayHelp, looks like this:
Function displayHelp(labelClicked As String)
'''''copy the contents of a text file to another file''''
setCurrentInfoText getDbPath & "macrosFiles\abbreviatedHelp\" & labelClicked
& "helptext.txt"
'''''open a popup form which reads the text from the copied text file and
display it''''
DoCmd.OpenForm "userInfoDisplay"
End Function
....which, in basic terms, just shows a certain text file, the filename of
which is obviously based on the name of the label.
There's dozens of these help labels for each userform, and lots of userforms
thanks to the fact that the country I'm working in has a tax system which,
despite recent renovation, can be likened to something out of at least a
Kafka novel, if not Dante's Inferno. If I was American I'd call it cruel and
unusual. Anyways, what I want to do is alleviate the necessity of copying
and pasting the name of the sub each time I write a help label onclick
function (thus saving myself from the rigours of carpal tunnel syndrome).
The way I see it, that would involve one of three things:
1. Programmatically determining the name of the sub that is currently being
executed, like this:
Private Sub lblHelpDonationsToExemptOrganisations_Click()
displayHelp Replace(THENAMEOFTHISSUB, "_Click", "")
End Sub
or...
2. Programmatically determining the name of the last label to be clicked,
like this:
Private Sub lblHelpDonationsToExemptOrganisations_Click()
displayHelp Replace(THENAMEOFTHELASTLABELCLICKED, "_Click", "")
End Sub
....or
3. Something I'm not clever enough to think of.
Me.ActiveControl does not cut the mustard - it doesn't recognise labels and
just gives you the name of the currently active button or textbox or whatever
(apparently considering labels to be untouchable out-castes beneath it's
notice, relegating them to the level of pond scum or perhaps amoebas). I've
spent hours scrolling through the object browser and this group and Googling,
looking for other likely candidates, but no joy.
Any ideas will be gratefully received. Probably pathetically gratefully
received, actually. Thanks, G
Situation: Access form with a profusion (some might even say a cornucopia)
of text labels (which appear as hyperlinks thanks to the simple trick of just
putting a space in the hyperlink address property - thanks to someone else
for that one). When the user clicks one of these labels, a popup form which
displays various helpful comments from yours truly to help the poor sap fill
out a tax return. The onclick function looks like this:
Private Sub lblHelpDonationsToExemptOrganisations_Click()
displayHelp Replace("lblHelpDonationsToExemptOrganisations_Click", "_Click",
"")
End Sub
and the function it calls, displayHelp, looks like this:
Function displayHelp(labelClicked As String)
'''''copy the contents of a text file to another file''''
setCurrentInfoText getDbPath & "macrosFiles\abbreviatedHelp\" & labelClicked
& "helptext.txt"
'''''open a popup form which reads the text from the copied text file and
display it''''
DoCmd.OpenForm "userInfoDisplay"
End Function
....which, in basic terms, just shows a certain text file, the filename of
which is obviously based on the name of the label.
There's dozens of these help labels for each userform, and lots of userforms
thanks to the fact that the country I'm working in has a tax system which,
despite recent renovation, can be likened to something out of at least a
Kafka novel, if not Dante's Inferno. If I was American I'd call it cruel and
unusual. Anyways, what I want to do is alleviate the necessity of copying
and pasting the name of the sub each time I write a help label onclick
function (thus saving myself from the rigours of carpal tunnel syndrome).
The way I see it, that would involve one of three things:
1. Programmatically determining the name of the sub that is currently being
executed, like this:
Private Sub lblHelpDonationsToExemptOrganisations_Click()
displayHelp Replace(THENAMEOFTHISSUB, "_Click", "")
End Sub
or...
2. Programmatically determining the name of the last label to be clicked,
like this:
Private Sub lblHelpDonationsToExemptOrganisations_Click()
displayHelp Replace(THENAMEOFTHELASTLABELCLICKED, "_Click", "")
End Sub
....or
3. Something I'm not clever enough to think of.
Me.ActiveControl does not cut the mustard - it doesn't recognise labels and
just gives you the name of the currently active button or textbox or whatever
(apparently considering labels to be untouchable out-castes beneath it's
notice, relegating them to the level of pond scum or perhaps amoebas). I've
spent hours scrolling through the object browser and this group and Googling,
looking for other likely candidates, but no joy.
Any ideas will be gratefully received. Probably pathetically gratefully
received, actually. Thanks, G