PDA

View Full Version : [SOLVED:] listview in access : how to add a right click event



denbob
03-08-2022, 03:20 AM
How do I add a mouse right click event to a Listview control?
The Listview control seems to only have Item_click available to catch a mouse click event.

Purpose, right click on an item, and open the document linked to that item.
But I do not know how to add an event to the Listview class.

(it seems that I have to add the event myself, if other solutions exist, please don't hesitate to mention the other solutions)

thank you in advance,
Bob

arnelgp
03-08-2022, 04:53 AM
is it a Listview or a Listbox?
if listbox use double-click event or add a command button to carry the action.

SamT
03-11-2022, 01:41 PM
You have some work for yourself. You will need to use Access Form's MouseDown and MouseUp Events with button checking to create a BeforeRightClick event on a ListView Item.

PhilS
03-12-2022, 03:36 AM
How do I add a mouse right click event to a Listview control?
The Listview control seems to only have Item_click available to catch a mouse click event.

In the MouseDown event of the ListView store the value of the Button argument.
Then in the ItemClick event check if the right mouse button was triggering the preceding MouseDown.

Alternatively you can use the MouseUp event and use the coordinates with the HitTest method to get the item clicked.