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.

32 Assignattach a macro to a control

Select the ‘Push button’ icon from the controls toolbar.

Click and drag in the form to draw a button.

33 Draw 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.

34 Mouse Button Pressed

Click the Macro button in the Assign section.

35 Macro Selector

Navigate to the macro we created earlier and select it.

Click OK twice.

36 Properties Window

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.

37 Open The Form

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.