Forms are a useful way to create a user-friendly interface. Bound forms, which are linked to a record source like a table or query, can be used to add or edit data in the record source. Unbound forms, which aren’t linked to a record source, can be used as menus to navigate and open objects in your database and interactive dashboards.
From the Create ribbon, select Form Design to open a new unbound form in Design view. The first step of building a form is to add controls. Everything displayed on a form (or report) is in a control. Controls can have different functions. In a bound form, controls can be linked to specific data by setting the Control Source property to the appropriate field from the record source. Controls also can be calculated, where the Control Source is set to an equation, or they can be unbound, where they aren’t linked to data. Buttons, labels, lines, and rectangles are unbound controls.
First, add a title to the form. Select the label tool from the Controls group of the Design ribbon. (Look for the Aa icon.) Click near the top of the blank design space to drop the control. In the new label that appears, type “MENU” and press ENTER. From the Home ribbon, change the font size to 14. This will increase the size of the text and make it bigger than the label control. With the new label selected, move the mouse pointer over one of the square resizing handles on any side or corner, except for the upper-left corner. When the pointer changes to a double-headed arrow, double-click your mouse. This automatically sets the control size at the best height and width to fit its contents.
Next, add a button for opening reports. Select the Button tool from the Controls group. (Look for the “xxx” in a rectangle.) On the form design, click where you want the upper-left corner of the button to be. This will place the control and open the Command Button Wizard dialog. If the Command Button Wizard doesn’t begin, delete the newly created button and enable the wizard by selecting Use Control Wizards from the drop-list in the Controls group (click on the bottom-right corner of the Controls group). Then choose the button tool and try placing the button again.
Microsoft Access Tutorial: Creating a Menu Form. So here’s a recap of the basic steps First and foremost, you need to make a separate form that contains the data that will be retrieved when the user clicks a button in your menu form. Listed below are the steps in creating a main menu form. Open your Microsoft Access. How to Access MSI Boot Menu. Boot menu is always related to computer booting process. The booting process is as follows: POST first detects the peripherals and devices to make sure the hardware is ready; next, the computer accesses the BIOS firmware and then assigns to boot from the boot device with the first priority; finally, read the assigned boot device to enter the operating system.
Once the wizard begins, choose Report Operations from the Categories list and then Open Report from the Actions list (see Figure 1). Click Next. Select the report you want to open. In this case, it’s “r_SalesCrosstab_Percentages.” Click Next.
The wizard will ask if you want text or a picture in the button. Select the Text option and enter “Monthly Sales by Category Detail Report.” The next step will ask you to name the button. Enter “btn_OpenMonthSalesDetail” as the name, and click Finish.
Once you have created the first command button, repeat the same steps to place another button that will open a different report. This time, choose “r_SalesCrosstab_Percentages_Summary” for the report to open, “Monthly Sales by Category Summary Report” for the display text, and “btn_OpenMonthSalesSummary” for the name of the button.
Just as buttons can open reports, they also can be used to open other forms to display and edit information stored in tables. The database already contains a form for entering information about products that Mike’s Music sells, and we want to add a button to open the form.
Add a button control to the form. As you go through the steps of the Command Button Wizard, choose Form Operations from the Categories and Open Form from the Actions. Select “f_PROD_CATS” from the list of forms in the database, then choose “Open the form and show all the records.” Select the Text option and type “Edit Products” to be displayed. Name the button “btn_Products” and click Finish.
Save the form and call it “fMENU.” Change to Form view and test the menu. Click on each button to make sure the correct report or form opens. Close the objects when you’re done looking at them.
Once you confirm that the buttons work properly, it’s time to clean up the look and design of the menu. Note that there are record selectors on the left side of the form as well as navigation buttons and filters along the bottom (see Figure 2). Since this form isn’t bound to data, we don’t need the selectors. Switch back to Design view and open the Property Sheet. With the Selection Type set to Form, go to the Format tab and locate the Record Selectors property and Navigation Button property, setting both to “No.” Return to Form view, and they will be gone.
This month, we created two separate buttons that open the Detail and Summary reports, respectively. (Download this month’s database: SF_July_2016_MenuForm.) But the only difference between the Detail and the Summary reports is that the detail section isn’t visible on the Summary report. It’s possible to set up one report instead and then program some logic that determines whether the detail or summary data gets displayed when the report opens. We’ll cover that next month when we discuss sections.
In addition, we will also address moving the title to the form header section of the menu, organize things the user can pick using a tab control, and create controls to collect criteria so reports only show certain records rather than everything. We’ll also make the menu form appear when the database opens.
Displays the appropriate menu or toolbar command for Microsoft Access.
expression.DoMenuItem (MenuBar, MenuName, Command, Subcommand, Version)
expression A variable that represents a DoCmd object.
|MenuBar||Required||Variant||Use the intrinsic constant acFormBar for the menu bar in Form view. For other views, use the number of the view in the MenuBar argument list, as shown in the Macro window in previous versions of Microsoft Access (count down the list, starting from 0).|
|MenuName||Required||Variant||You can use one of the following intrinsic constants:|
You can use acRecordsMenu only for the Form view menu bar in Access version 2.0 and Access 95 databases. For other menus, use the number of the menu in the MenuName argument list, as shown in the Macro window in previous versions of Access (count down the list, starting from 0).
|Command||Required||Variant||You can use one of the following intrinsic constants:|
For other commands, use the number of the command in the Command argument list, as shown in the Macro window in previous versions of Access (count down the list, starting from 0).
|Subcommand||Optional||Variant||You can use one of the following intrinsic constants:|
The acObjectVerb constant represents the first command on the submenu of the Object command on the Edit menu. The type of object determines the first command on the submenu. For example, this command is Edit for a Paintbrush object that can be edited.
For other commands on submenus, use the number of the subcommand in the Subcommand argument list, as shown in the Macro window in previous versions of Access (count down the list, starting from 0).
|Version||Optional||Variant||Use the intrinsic constant acMenuVer70 for code written for Access 95 databases, the intrinsic constant acMenuVer20 for code written for Access version 2.0 databases, and the intrinsic constant acMenuVer1X for code written for Access version 1.x databases. This argument is available only in Visual Basic.|
NOTE: The default for this argument is acMenuVer1X, so that any code written for Access version 1.x databases will run unchanged. If you are writing code for a Access 95 or version 2.0 database and want to use the Access 95 or version 2.0 menu commands with the DoMenuItem method, you must set this argument to acMenuVer70 or acMenuVer20.
Also, when you are counting down the lists for the MenuBar, MenuName, Command, and Subcommand action arguments in the Macro window to get the numbers to use for the arguments in the DoMenuItem method, you must use the Access 95 lists if the Version argument is acMenuVer70, the Access version 2.0 lists if the Version argument is Version, and the Access version 1.x lists if Version is acMenuVer1X (or blank).
NOTE: There is no acMenuVer80 setting for this argument. You can't use the DoMenuItem method to display Access commands (although existing DoMenuItem methods in Visual Basic code will still work). Use the RunCommand method instead.
In Microsoft Access 97 and later, the DoMenuItem method was replaced by the RunCommand method. The DoMenuItem method is included in this version of Access only for compatibility with previous versions. When you run existing Visual Basic code containing a DoMenuItem method, Access will display the appropriate menu or toolbar command for Access 2000. However, unlike the DoMenuItem action in a macro, a DoMenuItem method in Visual Basic code isn't converted to a RunCommand method when you convert a database created in a previous version of Access.
Some commands from previous versions of Access aren't available in Access, and DoMenuItem methods that run these commands will cause an error when they're executed in Visual Basic. You must edit your Visual Basic code to replace or delete occurrences of such DoMenuItem methods.
The selections in the lists for the MenuName, Command, and Subcommand action arguments in the Macro window depend on what you've selected for the previous arguments. You must use numbers or intrinsic constants that are appropriate for each MenuBar, MenuName, Command, and Subcommand argument.
If you leave the Subcommand argument blank but specify the Version argument, you must include the Subcommand argument's comma. If you leave the Subcommand and Version arguments blank, don't use a comma following the Command argument.
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.