Ms-Access Advanced VBA Programming Techniques, Tips and Tricks.

Create Menus with Macros

We have learned how to create Menus and Toolbars through Toolbars - ->Customize options earlier.  If you would like to have a second look at them then the links are given below:

There are other methods to create simple custom menus for Forms/Reports and use them with your Applications.  We are going to learn how to create a Shortcut Menu with Macros and attach it to a Form.

  1. Select the Macro Tab on the Objects pane.
  2. Click New to open a new Macro in Design View.
  3. If the Macro Name Column is not visible then click on the Macro-Name Toolbar Button (with xyz label) to display the Macro Name Column.
  4. Type Clo&se under the Macro Name column in the first row.
  5. Select Close from the drop down list of Action.
  6. Type &Preview in the second row under Macro Name.
  7. Under Action select OpenReport from the drop-down list.
  8. In the Property Sheet under Action Arguments select a Report from your list of Reports (I have selected Employees in the sample image given above) in the Report Name Property.
  9. Select Print Preview in the View Property.
  10. Type &Form in the third row under the Macro Name column.
  11. Select  Open Form in the Action Column.
  12. Select an existing Form's name from the Form Name Property drop-down list.
  13. Select Form in the View property.
  14. Type a dash (-) character in the next row under Macro Name column.
  15. Type &GotoNext in the fifth row under Macro Name column.
  16. Select GotoRecord in the Action Column.
  17. Type &Minimize in the sixth row under Macro Name.
  18. Select Minimize from the drop-down list in Action Column.
  19. Save the Macro with the name mcrShortCut and close it.

You can add as many commands or actions like opening Queries or running Programs etc. can be added to your menu for the convenience of your Application Users.

Our work on the Macro Menu is complete, but a little more work is left to define the Macro as a Menu. 

  1. Open a new macro in design view.
  2. Select AddMenu from the drop-down list in Action Column.
  3. Leave the Menu Name Property Blank. This is used for Group Menu Names when you have group Menus with different set of actions.  In this case this Macro will have more than one AddMenu Action lines with different set of Menu Macros.
  4. Select mcrShortCut in the Menu Macro Name Property.
  5. Save the macro with the name mcrShortCutMenu.
  6. Open one of your Forms in Design View (don't open the Form that you have used in the OpenForm action in the first macro).
  7. Display the Form's Property Sheet (View - ->Properties).
  8. Set the following Property Values of the Form as given below:
    • Shortcut Menu = Yes
    • Shortcut Menu Bar = mcrShortCutMenu
  9. Save the Form.
  10. Open the Form in normal view.
  11. Right-Click on the Form to display the Shortcut Menu.  See the sample image given below:

Try out options displayed in the Shortcut Menu.

We can not only create Shortcut Menus but also Toolbars and Menu Bars too.  This we will learn Next.

Share:

1 comment:

  1. [...] plant species in the same area and make many vegetables and fruit grown together | Fresh News LEARN MS-ACCESS TIPS AND TRICKS - Create Menus with Macros Graphic Design Projects – 890th Edition « Freelance Graphic Design Projects « [...]

    ReplyDelete

Trending

Popular Posts

Search This Blog

Blog Archive

Powered by Blogger.

Labels

Forms How Tos MS-Access Security Functions Reports Animations msaccess animation msaccess forms Utilities msaccess controls Access and Internet MS-Access Scurity MS-Access and Internet Queries External Links msaccess reports msaccess tips Menus and Toolbars Accesstips MsaccessLinks Process Controls Art Work Downloads msaccess How Tos Graph Charts msaccessQuery List Boxes Command Buttons Emails and Alerts Query Combo Boxes Custom Wizards msaccess graphs msaccess reporttricks ms-access functions msaccessprocess security advanced Access Security DOS Commands Data Macros Menus Property Report Top Values VBA msaccess email msaccess menus progressmeter Access2007 Array Auto-Number Command Button Join Microsoft Numbering System Records Security Split SubForm Table Utility Workgroup database msaccess functions msaccess wizards Access2003 Accounting Year Action Animation Attachment Binary Numbers Budgeting Calculation ChDir Color Palette Conditional Formatting Controls Copy Custom Functions Data Filtering Data Type Defining Pages Diagram Disk Dynamic Lookup Error Handler Excel Export Expression External Field Type Fields Filter Form Form Instances Formatting Groups Hexadecimal Numbers Import Labels List Logo Macro Mail Merge Main Form Memo Methods Monitoring Object Reference Objects Octal Numbers Operating System Paste Primary-Key Product Rank Reading Rich Text Sequence SetFocus Summary Tab-Page Time Difference Union Query User Users Variables Water-Mark Word automatically commands function hyperlinks iSeries Date iif ms-access msaccess msaccess alerts pdf files reference restore switch text toolbar tutorial updating upload vba code

Featured Post

Important Notice

Dear Readers, Very sorry to inform you that I am finding it difficult to renew my contract with the Hostgator Hosting Plans to continue prov...

Labels

Blog Archive

Recent Posts