Add a Popup Menu to form with existing menu

Posted on 2005-04-13
Last Modified: 2012-05-05
I used menu editor to create a drop down menu across the top of one of my forms.  The menu is similar to:

File        Edit     Help

Save      Cut      Version
New      Paste    About
Open     Copy

I now want to add a popup menu to the form which shows when the user right clicks while some of the controls have focus.  How do I add the popup menu.  Every time I enter the menu editor for the form I see the existing menu but I want to create a totally new one.

Question by:mlcktmguy
    LVL 4

    Accepted Solution

    On the same menu editor create your new popup menu and uncheck the visible box

    On click or mousedown and or mouseup and button =2 add:
    PopupMenu YourRightClick Menu Name

    Create a new Main Menu Item:
    Caption: Right Click  Name: mnuRightClick
    Uncheck the Visible Box (in other words, it will not be visible in the main menu that appears on form)
    Add SubMenu Items
    Caption: Copy Name: mnuRCCopy
    Caption: Edit   Name: mnuRCEdit

    Example Code

    Private Sub Text1_Click(Index As Integer)
        If Button = 2 Then PopupMenu mnuRightClick
    End Sub
    LVL 1

    Author Comment

    The instructions to build the menu are right on but the code to recognize the click doesn't seem to work.

    The click events on my textbox does not have the (Index as integer)  parameter.  When i add it the compiler objects.
    LVL 1

    Author Comment

    diregard last post, I found the Button and other variables in the mouse down event.

    Thanks for the help.  You get the points

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    use like in If/Then vba 4 44
    MS Access "DoCmd.applyfilter" 16 71
    z = x + y – 1 6 48
    Determine Range to Select 5 26
    There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
    If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now