How to assign a popup menu to a text box

accesser2003

Registered User.
Local time
Today, 22:55
Joined
Jun 2, 2007
Messages
124
I have a text box. when I right click on this text box, I want to show a popup menu with a shortcut: Shift to another department. when I click this shortcut, I want to execute instructions.

How can I make this.

Thanks,
 
I have a text box. when I right click on this text box, I want to show a popup menu with a shortcut: Shift to another department. when I click this shortcut, I want to execute instructions.

How can I make this.

Thanks,

You need to use the CreatePopupMenu API to create new or custom popup menu's, Access doesn't natively support this functionality.

Below are specifically the APIs you'll need to create/destroy a menu, add items to a menu, and track what a user selects from the menu.

Also I would suggest doing this on Left Click as right click will bring up the Access default menu in addition to your own custom menu.

Code:
Private Declare Function CreatePopupMenu Lib "user32" () As Long
Private Declare Function TrackPopupMenu Lib "user32" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal X As Long, ByVal Y As Long, ByVal nReserved As Long, ByVal hwnd As Long, ByVal lprc As Any) As Long
Private Declare Function AppendMenu Lib "user32" Alias "AppendMenuA" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpNewItem As Any) As Long
Private Declare Function DestroyMenu Lib "user32" (ByVal hMenu As Long) As Long
 
But how can I get the user selection so I write the instruction in the related event after the user selet the menu item.

Thanks
 
But how can I get the user selection so I write the instruction in the related event after the user selet the menu item.

Thanks
 
But how can I get the user selection so I write the instruction in the related event after the user selet the menu item.

Thanks
 

Users who are viewing this thread

Back
Top Bottom