Advanced Database – Assign/attach a macro to a control
Another way to directly run a macro is to create a button in the form.
In the main Base window, right click the form and click Edit to open it in design view.
Select the ‘Push button’ icon from the controls toolbar.
Click and drag in the form to draw a button.
Right click on the button and select Control.
In the properties window, click the events tab.
Click the … symbol next to the ‘Mouse button pressed’ section.
Click the Macro button in the Assign section.
Navigate to the macro we created earlier and select it.
Click OK twice.
In the properties window, click the General tab.
In the label section type ‘Create New Record’.
This changes the text displayed on the button.
Close the properties window save the form and exit the design view.
Double click to from the main window to open the form.
Now, if you want to add a new record you can just click the push button.
Again, this makes it much clearer for a novice database user when inputting data through the form.