Consulting

Results 1 to 4 of 4

Thread: listview in access : how to add a right click event

  1. #1
    VBAX Newbie
    Joined
    Jun 2019
    Posts
    5
    Location

    listview in access : how to add a right click event

    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

  2. #2
    is it a Listview or a Listbox?
    if listbox use double-click event or add a command button to carry the action.

  3. #3
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    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.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  4. #4
    Quote Originally Posted by denbob View Post
    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.
    Learn VBA from the ground up with my VBA Online Courses.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •