Example of creating a userform using the «Macro List» component

Print Previous page Top page Next page

Let's consider creating a user form «Print Report». The form contains a button «Report», which, when clicked, will generate a report in Microsoft Excel. The report is printed based on a template created and configured in advance.

 

To create the form, you need to perform the following steps:

1) In the «Database Administrator» in the «User Forms» tab, click the «Create» button. The «Forms Constructor» will be activated;

2) Place the «Table» component (or «Query_ADO») on the form and configure it;

3) Place the «Macro List» component on the form;

4) Using the specialized «Form Macro Editor» of the component (which is accessed through the property value field - object «Macro List» in the «Object Inspector»), add a macro;

5) Specify the data set, name, select the macro type - Report for DS (Data Set);

6) Select the report type and the template file name (optional parameter);

7) Rename the macro for clearer and more convenient use. For example, replace the name «Form_Macro1» with «Print»;

8) Click the «Exit» button of the «Form Macro Editor»;

9) Place a «Button» component on the form. Set the value of the «Macro» property to «Print»;

10) Save the created form.