locked
Right-Click Menu for Datasheet View in Access Runtime RRS feed

  • Question

  • I know that I'll have to program my own right-click menu to use in Access runtime. My question is, how can I detect which menu I should be bringing up when the user right clicks? If they are clicking on a row, I would like to bring up a different menu than if they are clicking in a cell or on a column header.
    Tuesday, May 8, 2012 8:57 PM

Answers

  • I have listed a couple of articles below that demonstrates how you can create shortcut menus in Access 2007 / Access 2010.  From what I can see, you can set a shortcut menu for a form, a report, or a control on those objects.  If you have a form that is displayed in datasheet view, I am not aware of a way to create separate shortcut menus for the columns and rows.  You could create a shortcut menu for the form itself, which will show when you click on a column or entire row, but this will be the same for both.  You could then assign a different shortcut menu for each control.

    How To:  Create a Shortcut Menu for a Form, Form Control, or Report - http://blogs.office.com/b/microsoft-access/archive/2009/05/21/how-to-create-a-shortcut-menu-for-a-form-form-control-or-report.aspx

    Create custom menus and shortcut menus by using macros - http://office.microsoft.com/en-us/access-help/create-custom-menus-and-shortcut-menus-by-using-macros-HA010282509.aspx

    Hopefully the info in these articles help.

    Best Regards,
    Nathan O.
    Microsoft Online Community Support


    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    • Marked as answer by villagemedia Thursday, May 24, 2012 3:11 AM
    Friday, May 11, 2012 8:15 PM
  • Hi Avechekav,

    The reason I provided links to those articles was not to tell you how to create the menus (though they might be a good reference if you do need help) but to point out that Access allows you to set a menu for an entire form, an entire report, or controls on those objects.  I don’t know of any way to change the menu for column headings or rows that have been selected.  Perhaps someone else does.  I agree Access has these types of menus built into it, but if we could create / customize all of them then I would think these articles would discuss how we can do this in a table or query.

    Best Regards,
    Nathan O.
    Microsoft Online Community Support


    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.




    Thursday, May 17, 2012 2:00 PM
  • OK, I did follow your advice and I've made a right-click menu that is now assigned to the entire datasheet subform. It works great, all except the default Access menu still comes up if the user clicks on a column/header (full version of Access with default menus enabled). I have figured out a quite clumsy work-around for that one too. On the datasheet subform's MouseUp event I check to see if they right clicked, and if they did, I run the following code:

    If Button = 2 Then Me.ShortcutMenu = False CommandBars(Me.Name & "RClickHeaderMenu").ShowPopup Me.TimerInterval = 3000 'give it three seconds before setting Me.ShortcutMenu = True End If


    • Marked as answer by villagemedia Thursday, May 24, 2012 3:11 AM
    Thursday, May 24, 2012 3:10 AM

All replies

  • Hi aychekay,

    Welcome to the MSDN forum!

    We are doing research on this issue and we will let you know if there is any progress.

    Thanks for your understanding and have a nice day.


    Yoyo Jiang[MSFT]
    MSDN Community Support | Feedback to us

    Friday, May 11, 2012 7:55 AM
  • I have listed a couple of articles below that demonstrates how you can create shortcut menus in Access 2007 / Access 2010.  From what I can see, you can set a shortcut menu for a form, a report, or a control on those objects.  If you have a form that is displayed in datasheet view, I am not aware of a way to create separate shortcut menus for the columns and rows.  You could create a shortcut menu for the form itself, which will show when you click on a column or entire row, but this will be the same for both.  You could then assign a different shortcut menu for each control.

    How To:  Create a Shortcut Menu for a Form, Form Control, or Report - http://blogs.office.com/b/microsoft-access/archive/2009/05/21/how-to-create-a-shortcut-menu-for-a-form-form-control-or-report.aspx

    Create custom menus and shortcut menus by using macros - http://office.microsoft.com/en-us/access-help/create-custom-menus-and-shortcut-menus-by-using-macros-HA010282509.aspx

    Hopefully the info in these articles help.

    Best Regards,
    Nathan O.
    Microsoft Online Community Support


    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    • Marked as answer by villagemedia Thursday, May 24, 2012 3:11 AM
    Friday, May 11, 2012 8:15 PM
  • If you look at the default datasheet right click menus, there must be some logic that determines if the user has selected rows or columns because there are different menus displayed depending on your selection.

    I'm not asking about how to create menus, thank you very much. I already know how to do that.

    I just need to know how to determine which menu to show. The native Access behavior already has this ability so I think it should be possible.


    Wednesday, May 16, 2012 6:30 PM
  • Hi Avechekav,

    The reason I provided links to those articles was not to tell you how to create the menus (though they might be a good reference if you do need help) but to point out that Access allows you to set a menu for an entire form, an entire report, or controls on those objects.  I don’t know of any way to change the menu for column headings or rows that have been selected.  Perhaps someone else does.  I agree Access has these types of menus built into it, but if we could create / customize all of them then I would think these articles would discuss how we can do this in a table or query.

    Best Regards,
    Nathan O.
    Microsoft Online Community Support


    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.




    Thursday, May 17, 2012 2:00 PM
  • OK, I did follow your advice and I've made a right-click menu that is now assigned to the entire datasheet subform. It works great, all except the default Access menu still comes up if the user clicks on a column/header (full version of Access with default menus enabled). I have figured out a quite clumsy work-around for that one too. On the datasheet subform's MouseUp event I check to see if they right clicked, and if they did, I run the following code:

    If Button = 2 Then Me.ShortcutMenu = False CommandBars(Me.Name & "RClickHeaderMenu").ShowPopup Me.TimerInterval = 3000 'give it three seconds before setting Me.ShortcutMenu = True End If


    • Marked as answer by villagemedia Thursday, May 24, 2012 3:11 AM
    Thursday, May 24, 2012 3:10 AM