shaun37
asked on
How to reference the Tag of a custom button on a shortcut menu (Access2000)
I have a form with a textbox (memo) that is tied to a shorcut menu with custom buttons.
How do I reference the tag on the custom button when it gets clicked??
How do I reference the tag on the custom button when it gets clicked??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I've tried to make each of your suggestions work but it isn't happening. I'm attaching a code snippet and a sample db. SampleDb.mdb
Function TagThis()
Dim ctl As Control
Dim StartPos As Long
Dim PostInsert As String
Dim PreInsert As String
Set ctl = Screen.ActiveControl
StartPos = Forms!frmSample.txtMemo.SelStart
If Not IsNull(ctl) Then
PreInsert = Left(ctl, StartPos)
PostInsert = Right(ctl, Len(ctl) - Len(PreInsert))
'Instead of:
ctl = PreInsert & "<p>" & PostInsert
'I would like:
'ctl = PreInsert & [the selected custom command button TAG here] & PostInsert
End If
ctl.SelLength = 0
Forms!frmSample.txtMemo.SelStart = StartPos
End Function
ASKER
Increasing points - really need someone to take a second look....
ASKER
LSM,
Wait!! It just worked! The problem was that I had the value of the tag set the same as the name of the tag control. It was looking for a tag called "<p>" equal to the value of "<p>" and it didn't like that. When I changed the the tag name to "MyTag" it worked beautifully.
I've been looking at this for tool long. Thank you kindly. They're all yours.
Shaun
Wait!! It just worked! The problem was that I had the value of the tag set the same as the name of the tag control. It was looking for a tag called "<p>" equal to the value of "<p>" and it didn't like that. When I changed the the tag name to "MyTag" it worked beautifully.
I've been looking at this for tool long. Thank you kindly. They're all yours.
Shaun
Private Sub Command3_Click()
Dim sTag As String
sTag = Me.Command3.Tag
End Sub
?
mx