Results 1 to 4 of 4
  1. #1
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614

    Open right click custom menu below command button

    I use


    Code:
    Application.CommandBars("InvoiceMenu").ShowPopup
    to show the menu.The menu opens at the cursor location.

    Click image for larger version. 

Name:	Print.png 
Views:	14 
Size:	13.5 KB 
ID:	11958

    How to specify the X and Y values in Application.CommandBars("InvoiceMenu").ShowPopup X,Y to open the menu exactly below the command button as in second figure above. I think the X and Y values are screen related and the command button's left bottom corner's X and Y screen coordinates are required.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Me.ControlName.Top
    Me.ControlName.Left

    these command will give you the top left corner

    if you want to get the bottom left corner you maybe able to do it with

    Me.ControlName.Top + me.controlname.height
    Me.ControlName.Left

  3. #3
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    That doesn't work. The X and Y parameters in the ShowPopup method area are screen related. If the form is a popup one and it is moved, the Top and Left values of controlname do not change but the X and Y parameters change. I have tested it using Debug.Print Application.CommandBars("InvoiceMenu").Top & Left. The command button's left bottom corner's screen related X and Y coordinates are required.
    Last edited by amrut; 04-19-2013 at 01:08 AM.

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    it seems to me you're a bit stuck then because you're looking for a screen related coordinate pair for an application that don't really talk to one another.

    You can get screen related coordinates but they won't relate to your control, they'll relate to where your cursor is
    You can get application related coordinates but, as you pointed out, they won't relate to the screen coordinates.

    If you find a solution I'd like to know it but I don't know that you'll find one.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 01-15-2013, 07:28 PM
  2. Custom button click to Built-in pop-up filter
    By LindaRuble in forum Reports
    Replies: 1
    Last Post: 08-23-2012, 07:00 PM
  3. Replies: 4
    Last Post: 04-14-2012, 07:22 PM
  4. Report does NOT open on BUTTON CLICK
    By taimysho0 in forum Programming
    Replies: 3
    Last Post: 01-04-2012, 02:38 PM
  5. Command button click event
    By R_jang in forum Programming
    Replies: 10
    Last Post: 10-29-2010, 10:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums