Access creating the main button form. Where have the button forms gone? Command: Go to button form

A button form is a standard method of organizing the interface in applications created using MS ACCESS. A button form is a page that contains buttons that let you open other pages, prompts, dialog boxes, and forms, view and print reports, and perform other actions. You can create a button form manually (using the designer) or use the function Button Form Manager .

To create a button form for working with a database Computer_mag by using Button form manager :

1. Call Button Form Manager menu command . When prompted to create a button form, click the button Yes . A dialog box will open Button Form Manager (Fig. 64).

Fig.64. Prompt to create a button form button form manager dialog box

2. With a highlighted line Main Button Form (Default) click on the button Change . In the opened window in field Button name instead of Main button form Enter your name - Computer store(Fig. 65) and click on the button Close . Button form Computer store is now the main one for the database Computer_mag.

Fig.65. Window Changing a button form page

3. In the window Button form manager click on the button Create . A dialog box will open Creation (Fig. 66), in which you need to assign names to new pages added to the button form.

Rice. 66. Dialog window Creationnew page push-button

4. Enter Forms to replace the contents of the field and click on the button OK . Click the button again Create , enter Requests as the name of the new page and click on the button OK . Create a page in the same way Reports. In the dialog box Button Form Manager Three new pages will now be displayed (Figure 67).

Rice. 67. Button Pages

5. With the page highlighted, click on the button Change . In the opened window Changing a button form page click on the button Create . A dialog box will open to create buttons on the form (Figure 68).


Rice. 68. Dialog window Changing a button form element

First field is intended for entering a label on the button. In second field a command is entered that should be executed when the button is clicked, and in third field– information (parameters) required to execute the command. All this information is stored in the button form elements table.

6. In the field Text: enter - Forms, in the second field Team: leave the value - Go to button form. In the third field Button form: click on the list pointer, select the value - Forms and click on the button OK .



Note

The label and contents of the list in the third field depend on the command selected in the second field.

7. Click the button again Create . In field Text: enter - Requests, in the field list Button form: select a value from the list Requests and click on the button OK . Similarly create a button on a button form - Reports and click on the button OK .

8. Now in the dialog box Changing a Button Form the names of the three created buttons will appear (Fig. 69).

Rice. 69. Names of buttons on the button form Computer store

9. Click the button Close to return to the window Button form manager .

Now your task is create buttons to open forms, queries and reports(they must already have been built earlier), using a button form.

10.Highlight a page Forms , and then click the button Change .

11.In the dialog box that opens Changing a button form page click on the button Create to create an element (button) on this page. Add four buttons with the following properties:

12.Now on the page Forms buttons have been created to open the above forms (Fig. 70). Click the button Close to return to the window Button Form Manager .

Rice. 70. Button form page Forms with created buttons

13.Highlight a page Reports , click on the button Change and add four buttons to this page with the following properties:

14.Click on the button Close to return to the window Button Form Manager . Click the button Close to close this window.

Note

Tables and queries can only be opened in Access using macros. Therefore, to create buttons that open queries that you created earlier, you need to use a macro.

So, to create macros to open requests in a button form, click on the object Macros in the Database Objects window. In the window that opens, you can see the macro you created earlier - View_Computers. To create a request opening macro:

1. Click on the icon Create to open the macro creation window. In field Macro command in the drop-down list, select the value - OpenRequest .

2. In a group Macro Arguments in point Request name from the opening list of requests, select – Query with parameter ; in field ModeTable ; in field Data ModeChange (Fig. 71). Close the Macro Builder window and save the created macro under the name Macro_Query with parameter.

Rice. 71. Macro builder window for opening a query

3. Following steps 1-2 above, create macros to open all your queries and name them appropriately.

Now you can return to the button form and create buttons to open queries on the page Requests. For this:

1. Click on the object Forms in the Database Objects window. Start the button form manager with the command Service|Utilities|Pushbutton Form Manager . In the dialog box that opens Button Form Manager select page Requests and click on the button Change to create buttons on this page to view all created queries. In the opened window Changing a button form page click on the button Create .

2. To configure a button to view a request Query with parameter needed in the window fields Changing a button form element enter the required data (Fig. 72).

Rice. 72. Creating a button on a page Requests

3. Similarly, create on the page Requests buttons to open all queries you have created previously. Additionally, create a button Return to close the page Requests(see above). Now on the page Requests buttons have been created for all requests (Fig. 73). Click the button Close to return to the window Button Form Manager , in which also click on the button Close .

Rice. 73. Window Changing a button form page with created buttons

To close the button form and database you need to create on the main page Computer store corresponding buttons. But in the button form manager you can only close the form using a macro, so:

1. Create a macro to close the button form and give it a name - Closing a button form(Fig. 74).

Rice. 74. Creating a macro to close a button form

2. Run Button Form Manager. In the window that opens, select the title of the main page of the button form and click on the button Create . In the opened window Creation (Fig. 75) set the name of the new page of the button form - Close button form and click on the button OK . Repeat these steps again to create the last page of the button form − Close database.

Rice. 75. Creating a page Close button form

Now the contents of the main page of the button form Computer store looks like in Figure 76.

Rice. 76. View of the main page of a button form Computer store

3. Next, with a dedicated page Computer Store (Default) click on the button Change . In the opened window Changing a button form page click on the button Create to create a button that, when clicked, closes the button form.

4. In the dialog box that opens Changing a button form element in field Text: enter - Close button form. Clicking this button should close the button form.

5. Click the arrow in the box Team: and in the list of commands that opens, select – Run macro. The third field will be replaced with Macro . In the third field macro list, select – Closing a button form and click on the button OK to close the dialog box (Fig. 77) and save the changes.

Rice. 77. Window for creating a button to close a button form

6. Click the button Create to create a button to close the database. In the window that opens (Fig. 78) in the field Text: enter - Close database, in field Team: enter - Quit the application and click on the button OK .

Rice. 78. Window for creating a button to close the database

7. Now the main page of the button form Computer store will contain all the necessary buttons (Fig. 80). Click on the buttons one by one Close in the windows Changing a button form page And Button Form Manager.

Rice. 80. Button form home page Computer store

8. The created button form can be edited like any other form in design mode (change title, color, font, background, add a picture, etc.). To do this, on the Access toolbar, click the button View to display the button form in design mode. Edit the created form (Fig. 81) and close the window.

Rice. 81. Form designer window for editing a button form

9. Next, on the object panel of the database window, click Forms, and then in the list of forms, double-click Button form. The main button form window will open. Computer store(Fig. 82).

Rice. 82. Push Button Window Computer store

10. Check the operation of all buttons on the button form. Open the pages one by one Forms, Queries, Reports and check that all database objects are opened correctly. In case of failures or errors, edit the contents of the button form.

11. Close the button form window.

Note

You can modify the button form by opening Button Form Manager to add pages and commands, or use Design view to add pictures and other objects. Since everything necessary for the functioning of a button form is stored in itself and in the corresponding element table, you can copy or import the button form and element table into any database that requires a similar button form, modifying it, if necessary, using the button form manager.

In this lesson, the user will learn what form creation capabilities the mode offers Constructor, will see how to add controls to a form, and will also look at how to create a main button form that will allow you to combine forms from different tables with each other.

Topic: Technologies for searching and storing information

Lesson: Creating the main button form and controls

In the previous lesson we looked at the mode of working with forms Layout. There is another mode for working with forms, it is called Constructor. In this mode, we can place additional elements on the form, the so-called controls or dialog box elements. These are well-known elements to us: buttons, lists, list boxes. We can create all these elements in the mode Constructor.

As soon as we go into mode Constructor form, a tab immediately appears on the ribbon Constructor, and on it we will see all the controls available to us (Fig. 1). It is these elements that we can place on forms.

Rice. 1

Let's see how we can add these elements to the form in practice. To do this, let's go to Design mode (Fig. 2), then the Design tab will automatically appear on the ribbon, and we will see all the available elements (Fig. 1).

Let's select an element button(Fig. 3), right-click on it and mark the dimensions of the future button on the form (Fig. 4). A button creation dialog box will automatically appear where we can select a category and action (Fig. 5). For example, find the entry, and click Next. We can place either text or a corresponding standard image or overview icon on the button (Fig. 6). Let's click next and we will see that the next step is to set the name of the button, after which we click Finish (Fig. 7). The button has appeared, we can adjust the dimensions and switch to the mode Form in order to see how the button will be reflected on the form and try out its action (Fig. 8). Let's click on it; yes, indeed, as it should have been, a window appeared Search and Replace(Fig. 9). Let the surname Blok be the example, let the search be carried out in the category “museum-apartments of St. Petersburg”, let the match be in any part of the field and look through all records (Fig. 10). Let's click next, the button actually works correctly, and the information we need is found in the table (Fig. 11).

Rice. 2

Rice. 3

Rice. 4

Rice. 5

Rice. 6

Rice. 7

Rice. 8

Rice. 9

Rice. 10

Rice. eleven

In addition to command buttons, you can also place lists on the form. Selecting from a list provides faster access to the desired entry. Let's see how you can create a drop-down list on a form.

Let's create another control on the form and switch to the mode Constructor and select the control Combo box(Fig. 12), let us designate its location and dimensions (Fig. 13). After this a dialog box will appear Creating Combo Boxes, in which we can choose how the combo box will receive the value, select, for example, the third option and click next (Fig. 14). Let's choose a field Name and click Next (Fig. 15) and Finish. But we see that the title field already existed, it turned out to be an overlay, but we can simply delete the second title. Let's switch to mode Form, to try out the list. The list opens, we select a name museum-apartment A.S. Pushkin(Fig. 16) and we see that there is a transition to her picture (Fig. 17). That is, the combo box works.

Rice. 12

Rice. 13

Rice. 14

Rice. 15

Rice. 16

Rice. 17

If there is not one table in the database, but several and, accordingly, several forms, then you can create main button form, containing buttons, and by clicking on the buttons we can load a particular form.

Let's look at the steps involved in creating the main button form.

If the database has several tables and a corresponding number of forms, then it makes sense to create a main button form, which will serve as a kind of screen saver for the database in which all other forms can be loaded. Click on the tab on the ribbon Working with databases(Fig. 18), select the button form manager command there, and the message appears: Cannot find the button form in this database, so we press the button Create(Fig. 19). A dialog box will appear Button Form Manager, in which we can select the command Change, a window will appear Changing a button form page. Let's create the first button on it (Fig. 20). Let the text of this button be museum apartments and the command will be executed Open form for modification, and the form is . Let's create another button, which we'll call writers, when clicked the command will also be executed Open form for modification and shape writers(Fig. 21). Let's close the open dialog boxes, and we will see in the list of objects that new forms and corresponding tables have appeared (Fig. 22).

Let's open the button form. By default, it has this design (Fig. 23), there are two buttons on it, when you click on the first button, you go to the form museum-apartments of St. Petersburg, by clicking on the second one we will open the form writers, i.e. the button form works correctly. Now let's try to change its standard design, go to the mode Constructor, and we will see the properties window here. Thus, we can select any of the elements and change, for example, the background color (Fig. 24). And then we can place, for example, an image (Fig. 25). To do this, select an arbitrary image on our computer and go to the mode Form. Now our main button form has taken the following form (Fig. 26). You may not necessarily have an image of a computer, but the drawing that you chose at the previous stage. We can note that our design has changed for the better.

Rice. 18

Rice. 19

Rice. 20

Rice. 21

Rice. 22

Rice. 23

Rice. 24

Rice. 25

Rice. 26

Bibliography

  1. Ugrinovich N.D. Computer science-9. - M.: BINOM. Knowledge Laboratory, 2012.
  2. Gein A.G., Yunerman N.A. Computer science-9. - M.: Education, 2012.
  3. Solovyova L.F. Informatics and ICT. Textbook for grade 9. - St. Petersburg: BHV-Petersburg, 2007.
  1. Lessons-tva.info().
  2. Office.microsoft.com().
  3. Lessons-tva.info().

Homework

  1. What operating modes does the Form object support?
  2. How to add controls to a form in MS Access?
  3. What is the main button form?
  4. Is it possible to visually edit forms?

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.

Hi all! In this article I will tell you how to create a button in the database Microsoft Access.

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. 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”.

Choose appearance forms.

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

Open the form in design mode. How to create a button in Microsoft database Access 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.

Select “Macros” and click OK.

Typically, to work with an application, a special form is created, which is called the Main Switchboard and contains buttons that allow you to select the main functions or subsystems of the application. Such a form can be created, as usual, using the Form Builder, or you can use a special wizard called the Swithboard Manager. A Main Switchboard was created in the Northwind database without using a wizard. Let's see how to create a similar form using the Button Form Manager.

Select menu command Service, Utilities, Button Form Manager(Tools, Database Utilities, Swithboard Manager).

Since the database does not contain any button forms (at least not known to the wizard), a dialog box appears asking whether to create a button form. Click Yes.

Now the wizard creates a table “Switchboard Items” and a button form (Switchboard), which we will look at later. After this, a dialog box appears with a list of button form pages (Fig. 14.15).

Rice. 14.15. Dialog window Button Form Manager

This window lists all pages of the button form (there may be several of them). So far, only one page has been created, and we see it in the list. To create the desired buttons on it, click the button Change(Edit). A dialog box (Edit Switchboard Page) opens (Fig. 14.16), containing a list of form elements.

Rice. 14.16. Dialog window Changing a button form page

In this window, you can add, edit, and delete elements from the selected form page. You can also change the order of their placement on the page (using the buttons Down(Move down) and Up(Move up)).

In field Button name(Swithboard Name) We can change the standard name if necessary. The list of form elements is still empty and only one button is available Create(New). To create the first element, click this button. The Edit Switchboard Item dialog box appears (Fig. 14.17).

Rice. 14.17.

In field Text(Text) enter the name of the button to be created, for example Products. Second field Team(Command) allows you to define the action that will be performed after clicking this button. The list of these actions is presented in Fig. 14.17. There are 8 of them in total. This can be opening a form in the mode of adding records or editing, opening a report, running a macro or VPA procedure, launching the wizard to edit a button form, moving to another button form and exiting the application. Let's select, for example, Open form to edit(Open Form in Edit Mode). Then in the next field you need to enter the name of the form to open, “Products List” (Fig. 14.18) and click the button OK.

Comment

The name of the last field in the form in Fig. 14.18 changes depending on the selected command in the second field. If the action selected in the list does not require specifying an argument, the third field disappears altogether.

Rice. 14.18. Dialog window

Similarly, we will add buttons for other application objects: “Types” (Categories), “Suppliers” (Suppliers), “Orders”. Let's create a button Reports, which will open the Sales Reports Dialog form and an exit button from the application Exit. Let's close the dialog box Changing a button form page(Edit Switchboard Page) by clicking the button Close(Close).

The number of buttons on one form page is limited to 8. This does not mean that you cannot create more of them, you just have to do it manually. However, there is another way to overcome this limitation. If the number of actions that you would like to place on buttons exceeds 8, you can group some of the actions on a separate page of the button form. For example, let's create another page of our button form and place customer action buttons on it. To do this, in the dialog box Button Form Manager(Switchboard Manager) click button Create(New). In the dialog box that appears (Fig. 14.19), enter the name of the new page Clients and press the button OK.

Rice. 14.19.

Next, in the page editor, we will create elements in a well-known way: Customers, Customer stickers, Customer phone numbers, Customer orders, which open the corresponding forms. Don't forget to create a button that will allow you to return to the Main Switchboard. To do this you need to associate the command with it Go to button form(Go to Switchboard) (Fig. 14.20). Close this window to return to dialog box Button Form Manager(Switchboard Manager). You should have two pages appear in the list of pages.

Now you need to edit the first page - add an element to it that can be used to go to the second page. To do this, select the page (Main Switchboard) in the list and click the button Change(Edit). In the page editor window, add a new Clients element, also using the command Go to button form(Go to Switchboard).

Rice. 14.20.

Now both pages are linked. You can close the wizard window and see what we have done by opening the Switchboard form. A window similar to the one shown in Fig. should appear. 14.21.

Rice. 14.21.

You can check how the buttons work. For example, if you press the button Clients, The contents of the form will change and you will see the second page of the form. The form doesn't look very attractive, but now you can go to Design mode and customize its appearance using all the Design tools.

When you open this form in Design mode, you will not see its elements; the form seems completely empty. However, if you open the module associated with this form, you will see a fairly large amount of code that organizes the form to work properly. Moreover, for this purpose, information stored in a special table is used, which we mentioned at the beginning of the section: Switchboard Items(Pushbutton elements). You will see this table in the list Tables(Tables) windows Database(Database). In this case, it will look something like the one shown in Fig. 14.22.

Rice. 14.22. Table "Pushbutton Form Elements"

The first column contains the page ID, the second column contains the number of the element on the page. This number determines the order in which elements will appear on the page. The third column contains the text that appears to the right of the button. The last two columns define the command associated with the element: the command code (as we remember, there are 8 of them) and its argument. Code 0 corresponds to a special element that specifies the title of the page and defines its beginning.

Thus, using the Switchboard Manager, you can create a hierarchical system of switchboard pages, which can be an alternative to the usual hierarchical menu. True, unlike a menu, this form is not constantly visible on the screen; it can be covered by other forms. If you want to allow the user to open several forms and reports at once, you will have to create a button on the toolbar that would allow you to display the Main Switchboard at any time.

Share with friends or save for yourself:

Loading...