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
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