Internet. Computer. Help. Adviсe. Repair

Description of the main button form model in detail. Creating the main button form. Adding elements to a button form

The main button form is created for the purpose of navigating through the database, i.e. it can be used as the main menu of the database. The elements of the main button form are form and report objects.

Queries and tables are not elements of the main button form. Therefore, you can use macros to create Query or Table buttons on a button form. First, macros “Open Query” or “Open Table” with unique names are created in the database window, and then buttons for calling these macros are created in button form.

You can create several button forms for one database. Buttons should be grouped on button form pages in such a way that it is clear to the user in which button forms certain commands can be executed (queries, reports, data entry and editing). It should be noted that subordinate button forms must have return buttons to the main button form.

The technology for creating button forms is as follows:

1) create a main button form (GKF) page;

2) create the required number of pages of subordinate push-button forms (for example, forms for data entry, for reports, for requests, etc.);

3) create elements of the main button form;

4) create elements for push-button report forms and forms for entering or changing data;

5) create macros for queries or for tables with unique names;

6) create elements for push-button query forms or tables.

The structure of button forms can be presented as follows.

To create the main button form and its elements, you need to open the database (for example, “Student Performance”) and execute the command Access Options - Settings - Select commands from / “Working with Databases” tab – select Button Form Manager and add it to the Quick Launch Toolbar Settings.

If the button form has not been created previously, a dialog box will open "Button Form Manager"

in which you need to click the “Yes” button, thereby confirming the creation of the button form. As a result, the Main Button Form page will be created.

Next, you can create three more button form pages: Data Entry Forms, Reports and Queries. To do this, click on the “Create” button and in the window that appears, enter the name of the new page “Data Entry Forms”

and click on the “OK” button. The “Data Entry Forms” button form page will be created. In a similar way, you need to create two more pages, in the end we get four pages of push-button forms, which are displayed in the “Push Button Forms Manager” window.

After this, we create GCF elements; to do this, in the “Push Button Form Manager Window”, select the “Main Push Button Form” page and click “Change”, a new window “Changing Push Button Form Pages” will open.

In this window, click on the “Create” button, a new window “Changing a button form element” will open.

in which we do the following:

 enter the text: Forms for data entry;

 select the command from the drop-down list: Go to button form;

 select a push-button form from the list: Entering data into forms, click on the “OK” button.

The “Edit Pushbutton Form Page” window displays the “Data Entry Forms” button form element.

Using a similar method, you need to create the elements: “Queries” and “Reports”, and then the element (button) “Exit DB”.

As a result, all elements of the main button form will be displayed in the “Edit Button Form Page” window.

The button form appears in the list in the database window area on the Forms tab in the Objects panel, and the Switchboard Items table appears in the lists on the Tables tab. Double-clicking on the "Pushbutton Form" text will open the Main Pushbutton Form.

In order for this form to be displayed when starting the database, you must run the Access Options/Current Database command, in the View Form window, select “Push Button Form” from the drop-down list, and uncheck the Status Bar checkbox. You can also enter a title and icon for the application.

At this point, the creation of push-button forms is not yet complete, since there are no elements on the subordinate push-button forms (Data Entry Forms, Reports, Queries).

Creating Sub-Push Button Forms: Reports and Forms

To create push-button form elements "Data Entry Forms", you must launch the database (for example, "Student Progress" with the main push-button form) and execute the command Tools / Utilities / Push-button Form Manager.

The Button Form Manager window will open. Then you need to select “Data Entry Forms” in the “Push Button Forms Manager” window

and click on the Change button, the “Change button form page” dialog box will open.

in which we perform:

 enter the text: Students;

 select the command from the drop-down list: Open form for editing;

 select a button form from the list: Students, click on the “OK” button.

The "Edit Button Form Page" window displays the "Students" element. After creating the “Student Groups” element using the same technology, it will also be displayed in the window.

Next, you need to create a button to return to the main push-button form, to do this, click on the “Create” button and in the window that appears, select the command “Go to push-button form”, select “Main push-button form” and enter “Go to main push-button form”. Click on the “OK” button

and close the “Change button form page” window.

Let's launch the main button form in the database window, in which we click on the "Data Entry Forms" button, the "Data Entry Forms" will open.

The creation of elements for the “Reports” button form is carried out using the same technology, and the result will be:

Creating a Sub-ButtonForm: Queries

To create elements of the subbutton form "Queries", you need to run the database (for example, "Students' progress" with the main button form) and create macros "Open Query" or "Open Table" with unique names, and then create buttons in the button form to call these macros.

When creating a macro "Student Performance" you need to select the "Macros" tab and click on the "Create" icon, the "Macro" dialog box will open. In this window, select the "Open Query" macro action from the drop-down list and select the query name "Student Progress" from the drop-down list.

then click on the "Close" button. In the window that appears, "Save changes to the layout or structure of the Macro1 object?" Click on the "Yes" button. The “Save” window will open, in which you need to specify the name of the macro “Student Progress” and click on the “OK” button.

The macro name will be saved in the list of macros in the DB window. After creating and saving the "Parametric_query" macro, the names of the created macros will be displayed in the database window.

To create button form elements for the “Student Progress” request, you must execute the command Service / Utilities / Button Form Manager. The Button Form Manager will open.

Then you need to select “Queries” in the “Pushbutton Form Manager” window and click on the Edit button, the “Edit Pushbutton Form Page” dialog box will open.

In this window, click on the “Create” button, a new window “Changing a button form page” will open.

in which we perform:

 enter the text: Report: Student performance;

 select the command from the drop-down list: Run macro;

 select the button form from the list: Student Progress, click on the “OK” button.

The “Edit Button Form Page” window will display the “Report: Student Progress” button form element. After creating the “Parametric_query” element using the same technology, it will also be displayed in the window.

Next, close the “Change button form page” and “Push button form manager” windows. In the DB window, on the “Forms” tab, click on the “Push Button Form” inscription, and the Main Push Button Form will open. In the Main button form, click on the Requests button, and the “Requests” button form will open.

Thus, a button form "Requests" has been created, which is a subordinate button form.

Creating buttons on a form does not depend on what version of Access you have installed (2003, 2007, 2010, 2013 or 2016). In this article I will show 2 ways to create buttons on a form in the Acceess database: using a wizard and using a macro.

How to do it?

Step 1: Create a form

If you don't have a form, you need to create one. You can see more details on how forms are created. HERE. Go to the “Creation” tab, “Form Wizard” item. Next, select the table or query on the basis of which the form will be created. Next, select the required fields and click “Next”.

Selecting the appearance of the form.

Set a name for the form and click “Finish”.

Open the form in design mode. How to create a button in the Microsoft Access database will be described in the second step.

Step 2: Create a button using the wizard

On the toolbar, select the “Button” item and place it on the form. The Button Wizard window appears. Here you need to select the required category and set a specific action. Select “Previous Entry” and click “Next”.

Choose what to display on the button: text or image. Leave the default image and click “Next”.

Set a name for the button and click “Finish”.

Now let's create a button with text. Let’s go to the button wizard again and select “Next entry”.

Step 3: Create a button using a macro

On the toolbar, select the “Button” item and place it on the form. The Button Wizard window appears. Click “Cancel”.

Double-click on the created button to open the properties window. Go to the “Events” tab, “Button Press” item. Click the button with three dots.

We return to the form “Table 1”. Let’s rename the button and set it to “Exit”.

Let’s go to form mode and check how the “Exit” button works. The Microsoft Access application should close.

In this article, we looked at how to create a button in the Microsoft Access database.

If you need a ready-made Access database, then check out the list provided HERE.
-----------------
Useful links:
Lesson 17: Query Wizard
Lesson 16: Create Table Query
Lesson 15: Parameter Queries
Lesson 14: Queries with Calculated Fields
Lesson 13: How to determine YEAR, QUARTER, MONTH, DAY OF WEEK in a query
Lesson 12: How to Create a QUERY WITH CONDITION
Lesson 11: How to Set Conditions for TEXT Fields in Queries
Lessons on SQL queries

Button form is a form whose sole purpose is to redirect you to other forms (usually when you click a form button). It is a kind of main menu of your database. This form is both the starting point and the center of action. A typical push-button form contains a set of buttons that direct different places.

In Fig. 14.10 shows a type of button form created by Access.

Note

The created button form is similar to any other type of form, so once you create it, you can use the skills you learned in the last two chapters to make your button form look visually appealing.

Rice. 14.10. This Access button form gives you access to five different forms with one click. The advantage of Access button forms is that you can build your own in a matter of seconds. The disadvantages include a somewhat old-fashioned appearance, forcing impressionable users to design their own button forms from scratch

To automatically create a button form, you should use the Form wizard. The following describes how it works.

1. Select from the ribbon Working with Databases > Working with Databases > Button Form Manager(Database Tools > Database Tools > Switchboard Manager).

When you click this button in the database for the first time, Access will report that it cannot find the button form and will offer to create it. Click the Yes button to continue working with the Button Form Manager (Figure 14.11).

If a button form already exists, go to step 2, where you can edit the current button form.

Rice. 14.11. The button form manager displays a list of pages. Each page is a separate part of a button-shaped menu. The simplest button forms have only one page, which means the form supports one level of depth and each button performs a useful action (for example, opening a form or report)

Rice. 14.12. The window allows you to create menu commands, delete those that are no longer needed, change their order (this order determines the order of commands on the button form)

2. Click the button Change to edit a button form page.

A window appears on the screen Changing a button form page(Fig. 14.12). This is where the actual menu commands are defined.

3. To create a new menu command, click the button Create.

A window appears on the screen Changing a button form element(Fig. 14.13). To create a menu command, you need to provide two pieces of information: the text that appears on the form, and the command that Access should execute when you click the button.

Rice. 14.13. This command runs the report Attendance(attendance).

From the dropdown list Team select the action the command should perform

4. Enter menu text and then select the action you want the button to perform.
The following options are possible:

o Go to button form(Go to Switchboard) - goes to another page of the button form. Button pages can be used to break up really long menus into several shorter ones:

o Open form to add(Open Form in Add Mode) - opens the form in data entry mode, so you can insert new records;

o Open form for modification(Open Form in Edit Mode) - opens the form in normal mode for viewing and editing records. This mode does not allow form editing, despite the misleading name;

o Open report(Open Report) - opens the report in preview mode;

o Application designer(Design Application) - opens the Button Manager window, thus allowing you to edit the button form menu. This option rarely needs to be included on the menu;

o Quit the application(Exit Application) - ends the Access program:

o Run macro(Run Macro) and Execute the program(Run Code) - run the macro you created (see chapter 15) or code you wrote in Visual Basic (see chapter 16).

5. Repeat steps 3 and 4 until you have created all the necessary commands. Then click the button Close to return to the main window of the Button Form Manager.

Pushbutton forms have a nasty secret. You can only put eight menu commands on each page. If you need more (and who doesn't?), you should add additional pages to your menu.

You can follow any responses to this entry via the RSS 2.0 feed. You can leave a reply, or trackback from your own site.

Button form is a form whose sole purpose is to redirect you to other forms (usually when you click a form button). It is a kind of main menu of your database. This form is both the starting point and the center of action. A typical push-button form contains a set of buttons that direct different places.

In Fig. 14.10 shows a type of button form created by Access.

Note

The created button form is similar to any other type of form, so once you create it, you can use the skills you learned in the last two chapters to make your button form look visually appealing.

Rice. 14.10. This Access button form gives you access to five different forms with one click. The advantage of Access button forms is that you can build your own in a matter of seconds. The disadvantages include a somewhat old-fashioned appearance, forcing impressionable users to design their own button forms from scratch

To automatically create a button form, you should use the Form wizard. The following describes how it works.

1. Select from the ribbon Working with Databases > Working with Databases > Button Form Manager(Database Tools > Database Tools > Switchboard Manager).

When you click this button in the database for the first time, Access will report that it cannot find the button form and will offer to create it. Click the Yes button to continue working with the Button Form Manager (Figure 14.11).

If a button form already exists, go to step 2, where you can edit the current button form.

Rice. 14.11. The button form manager displays a list of pages. Each page is a separate part of a button-shaped menu. The simplest button forms have only one page, which means the form supports one level of depth and each button performs a useful action (for example, opening a form or report)

Rice. 14.12. The window allows you to create menu commands, delete those that are no longer needed, change their order (this order determines the order of commands on the button form)

2. Click the button Change to edit a button form page.

A window appears on the screen Changing a button form page(Fig. 14.12). This is where the actual menu commands are defined.

3. To create a new menu command, click the button Create.

A window appears on the screen Changing a button form element(Fig. 14.13). To create a menu command, you need to provide two pieces of information: the text that appears on the form, and the command that Access should execute when you click the button.

Rice. 14.13. This command runs the report Attendance(attendance).

From the dropdown list Team select the action the command should perform

4. Enter menu text and then select the action you want the button to perform.
The following options are possible:

o Go to button form(Go to Switchboard) - goes to another page of the button form. Button pages can be used to break up really long menus into several shorter ones:

o Open form to add(Open Form in Add Mode) - opens the form in data entry mode, so you can insert new records;

o Open form for modification(Open Form in Edit Mode) - opens the form in normal mode for viewing and editing records. This mode does not allow form editing, despite the misleading name;

o Open report(Open Report) - opens the report in preview mode;

o Application designer(Design Application) - opens the Button Manager window, thus allowing you to edit the button form menu. This option rarely needs to be included on the menu;

o Quit the application(Exit Application) - ends the Access program:

o Run macro(Run Macro) and Execute the program(Run Code) - run the macro you created (see chapter 15) or code you wrote in Visual Basic (see chapter 16).

5. Repeat steps 3 and 4 until you have created all the necessary commands. Then click the button Close to return to the main window of the Button Form Manager.

Pushbutton forms have a nasty secret. You can only put eight menu commands on each page. If you need more (and who doesn't?), you should add additional pages to your menu.

Using the main button form, you can navigate through database forms and reports. The database user does not need to view the entire database structure. Using forms, the user can make changes to tables and then receive reports taking into account the new data. Queries and tables are not elements of the main button form.

To create the main button form, you need to use the Button Form Manager tool. If this tool is not on the Database Tools tab, you can add it to the Quick Access Toolbar.

To do this, on the File tab, select Options, then Quick Access Toolbar. After this, on the Settings tab of the Quick Access Toolbar, select the “Working with Databases” Tab line from the drop-down list and select Button Form Manager in the list of commands (Fig. 1. 31).

Creating the main button form:

1. open the database;

2. go to the “Button Form Manager” (Fig. 1. 32);

3. If you are prompted to confirm the creation of the button form, click the “Yes” button.

1. further work will be done with a standard push-button form;

2. click the “Change” button;

3. click the “Create” button (Fig. 1. 33).

1. in the “Text” field, enter the text of the name of the first button of the button form, and then select a command for it in the Command field;

2. to create a second button, use the “Create” command, after which the “Edit button form element” window for the new button opens (Fig. 1. 34).

We get the main button form (Fig. 1. 35).

To change or delete any of the created buttons, select its name in the “Elements of this button form” list and click the “Change” or “Delete” button. If you need to change the order of button form elements, select the element in the list and use the Up or Down buttons.

When you've finished creating your button form, click the Close button.

To have the pushbutton open when you open the database, select the pushbutton name in the Switchboard Manager dialog box and click the Default button.

When you create a switchboard using the Switchboard Manager, a "Switchboard Items" table is created. This table describes the text and actions of the created form buttons. If you later need to make a change to the button form, you must first delete the corresponding “Switchboard Items” table and then make the changes.

Reports

Reports are used for formatted data output to printing devices. When creating a report, MS Access always operates with only one single table or query. If you need to combine information from several tables and/or queries in one report, you must first collect the desired data in one query.


The report structure consists of sections and controls. Designing a report consists of creating the structure of its sections and placing controls within these sections, as well as defining relationships between these elements and fields of tables or database queries.

The structure of the finished report differs from the structure of the form in the increased number of sections. In addition to header, note, and data sections, a report may contain header and footer sections. If the report spans more than one page, these sections are needed to print service information such as page numbers. The more pages a report occupies, the more important the role of the data printed through these sections. If grouping is applied to some report fields, the number of report sections increases because the group headings are formatted in separate sections.

Editing the report structure is performed in Design mode. Editing techniques are the same as for forms. In this case, controls act as design elements, since a printed report is not an interactive object, unlike electronic forms.

The easiest way to familiarize yourself with the report structure is by creating an auto-report and then opening it in Design mode.

The report structure consists of five sections: report header, header, data area, footer, and notes. The header section is used to print the general title of the report.

The header section can be used to print subheadings if the report has a complex structure and spans many pages. You can also place column numbers (page numbers) here, if this is not done in the footer.

The data area contains controls related to the contents of the fields of the database tables. These controls receive data from database tables, which can be used for printing.

The footer section is used for the same purposes as the header section.

The notes section is used to provide additional information.

Auto report is the simplest type of report (Fig. 1. 36). To create an auto-report, you need to select the object for which the report is being created in the Navigation panel and open the Create, Report tab.

In this case, we obtain an electronic form of the report containing all the fields of the object.

Using the Report Wizard.

In this case, a simple custom report is created in four steps:

· object selection;

· in the Reports group, select Report Wizard;

· select fields for the report;

· select the required field sorting order;

· select the type of report layout.

In this case, we obtain an electronic form of the report containing only the required fields of the object (Fig. 1. 37).


Section 2. Laboratory workshop

Laboratory work No. 5.

Subject: Creating button forms.

Target: Learn to create and edit button forms.

Exercise

Create a main button form and additional button forms for working with the database.

Basic information

SuperstructureAccessbutton form manager

Access add-ins are databases that contain procedures and their associated objects. There are three types of add-ons:

menu add-ons

· builders

· masters

Wizards and builders are context-sensitive add-ins. They are triggered when the user tries to perform certain actions. Menu add-ons are context independent and can be accessed from the menu ServiceÞ Utilities. An example of a menu add-in is the Button Form Manager.

Pushbutton forms (or menus) ) are forms in an application that provide access to application components and subsystems. Switching between components occurs by clicking buttons. Of course, you can build button forms in design mode by creating an event handling procedure for each button Button press. But in the case where the application includes many forms and reports, this work can be very time-consuming.

Button Form Manager uses a sophisticated technique to control all button forms through one button form, creates a driver table called Button Form Elements, and allows you to create up to eight elements in each button form. If more than eight buttons are required, then the missing ones are created manually by writing procedures or creating macros. When it starts, the dispatcher looks for a table in the current database with the name SwitchboardItems, and if there is none, it starts creating a new button form.

In the dialog box Button Form Manager all forms are called pages. The names of all button forms of the application are set here.

In the dialog box you can change the names of forms, edit form elements (button Change...), delete elements (button Delete) or change the position of an element (button Up And Down).

In the dialog box Changing a button form element three parameters are specified:

· Text– the name of the element that will appear on the button in the button form.

· Team– the command that will be executed when the user clicks the button.

· Form– the contents of this field depend on the value of the Command field.


Rice. 5.1 . Creating a button to add a new client.

After creating the button forms, a table will appear on the Tables tab of the database window SwitchboardItems, and on the Forms tab – form Switchboard, which can be renamed. But to rename the table SwitchboardItems, you need to change all references to it in the VBA (Visual Basic for Applications) procedures stored with this button form.

Work technology

Ccreating a button form

1. Open the database.

2. Select a team Service® Utilities® Button Form Manager.



Fig.5.2 Button form Forms .

3. When asked about creating a new button form, answer Yes.

4. In the window that appears Button Form Manager click the button Create.

5. Set the name of the additional button form – Forms. Click OK.

6. Set the name in the same way Reports for the second additional button form and names Form Client And Form Orders,Report ReportClients, Account And Exit for others.

7. In the window Button Form Manager select MainSwitchboard(Main button form) and click the button Change.

8. In the window Changing a button form page click the button Create.

9. In the window Changing a button form element specify the parameters:

Text: Forms

Team: Go to button form

Form: Forms

10. Click OK.

11. Button options Reports set in the same way.

12. For the button Exit set parameters:

Text: Exit

Team: Quit the application

13. Press the button Close.

14. In the window Button Form Manager select form Forms and press the button Change.

15. In the window Changing a button form page click the button Create.

16. In the window, specify the parameters:

Text: Working with the Client form

Team: Go to button form

Shape: Shape Client

17. Click OK.

18. In the same way, specify the parameters for working with ShapeOrders

19. Provide a button to return to the Main form:

Text: Return

Team: Go to button form

Form: Main Switchboard.

20. Click Close.

21. In the window Button Form Manager choose a form Form A Client and press the button Change.

22. In the window Changing a button form page press the button Create.

23. In the window Changing a button form element specify parameters:

Text: New client

Team: Opening a form in append mode

Form: Client

24. Click OK.

25. In the window Changing a button form page press the button again Create.

26. In the window Changing a button form element specify the parameters:

Text: Editing

Team: Opening a form in edit mode

Form: Client

27. Click OK.

28. Similar to steps 21-27, create buttons for working with the form Orders

29. Similar to step 19, create a button to return to the previous form.

30. In the window Button Form Manager select form Reports, press the button Change and create button form elements Reports(view reports and return).

31. Edit the ButtonForm in design mode.

1. Topic of laboratory work.

2. Purpose of laboratory work.

3. Technology for creating a push-button form.

Did you like the article? Share with your friends!
Was this article helpful?
Yes
No
Thanks for your feedback!
Something went wrong and your vote was not counted.
Thank you. Your message has been sent
Found an error in the text?
Select it, click Ctrl + Enter and we will fix everything!