Full Version: Menus in VBA Access? Also, manually position form?
UtterAccess Forums > Microsoft® Access > Access Forms
JojoMojo
Hi,
wo questions.
1. Can I have popup menus or regular main menus in VBA apps (like the menu controls in VB)? Ex: I want to show a popup menu with mutliple options when a user clicks on a button, OR I want to display a new menu (Ex: Test) in the currently existing VBA main menu.
2. How can I position my form to be in the upper right corner of the screen every time my project is launched (this is the primary form that is displayed by default). I can't find any LEFT/TOP properties of either the form or the screen.
Thanks!
Dr. J.
freakazeud
Hi,
for your first question I'm not sure if I understand you. You can have custom menu bars and you can have custom shortcut menu bars (right click). You can search UA for many discussions on this.
For your second question have a look at the movesize command:
oCmd.MoveSize [right][, down][, width][, height]
You would set autocenter and autoresize to NO. This way you can position your form wherever you want ALL the time.
HTH
Good luck
AQM_UK
Dr J.
. You can do anything you like with forms, opening other forms etc. Might need a bit more here.
2. DoCmd.MoveSize right,down,width, height in the on open proerty of the form. These are in twips so numbers would looks like 150,150,5000,7000. (basically, play with the numbers.)
HTH
Jim
JojoMojo
Thanks guys. Any idea how to get the current screen dimensions? Or the dimensions of the main Access window? I'll need this along with the DoCMD.MoveSize command to position the form to the upper-right corner. The reason I need this, instead of just passing along a fixed X,Y is because the access program is run from multiple PCs and different resolutions, so it may look completely different on one PC.

Otried searching around but so far I came up with nothing. Is there a menu control? I can't find it in the toolbox (sorry, I'm used to programming in VB/.NET and menus are created by dragging them from the toolbox onto the form).

Thanks!

Edited by: JojoMojo on Wed Jan 4 12:12:03 EST 2006.
GroverParkGeorge
I posted a demo of a menu technique which includes, as part of the code, API calls to retrieve the screen resolution. You'll have to sort that part out from the other stuff, but you should be able to figure it out.
It's available here.
George
JojoMojo
Thanks George. Great Example.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.