Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Popup Menu of Right Click on a Treeview

Status
Not open for further replies.

Marryp

Technical User
May 28, 2001
129
CA
I would like to use the right click on a TreeView to call my pop-up menu that has a expand and colapse functions. I tried the code below in VB and it works but it doesn't in MS Access 2000:

Code

Private Sub tvwDB_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)

Dim n As Node

If Button And acRightButton Then
Set n = tvwDB.HitTest(x, y)
If Not (n Is Nothing) Then
Set tvwDB.SelectedItem = n

'ShortcutMenuBar = "theMenu"

PopupMenu theMenu, vbPopupMenuLeftAlign Or vbPopupMenuRightButton

End If
End If

End sub
 
Did you ever solve this May6? I want to do the same thing.

FW
 
May6

Is it as simple as a minor mistake in your If expression.

Try changing it to 'If Button = acRightButton Then'

Regards

JT
 
I learned that this function is not available in VBA only in VB.
 
May6

I have just got a similar function to work correctly in Access 2002!

The only significant difference to your code was that I used a popup form rather than a popup menu and used the Click event of the treeview to record which was the currently selected node.

Regards

JT
 
Did anybody get this to work?
I want to create a right-click menu to copy, paste or move the selected node.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top