Share this page
Access - Macro commands
A macro allows to execute a series of instructions one after the other. Besides, you can "attach" a macro to a button on a form. The exercise that follows consists in creating a macro girl who contains a single instruction. Later, this macro short story(piece of news) will be attached to a button of a form.
From the main menu, select the macro tab .
The window of creation of macro will appear.
Under the column Action is the list of the instructions that you can execute.
To continue the creation of the macro, it's necessary to enter the " arguments of the action " or the characteristics of this one. These arguments change according to the type of action. For the action BoîteMsg (message box):
the text following in the box message: " This is a test ".
If you want to add another action, place the cursor below the last action and select it from the list of the actions.
To protect the macro:
the File menu, select the option, Save as / export.
this exercise, enter the name "Test"
The next part consists in attaching(fastening) the short story(piece of news) macro Test that has just been created in the previous part in a button of form. There are two ways to paste: paste to a new button or to an already existing button. This part will cover these two ways.
Paste to a new button.
to the main menu and click the Forms tab .
The assistant of command button offers several options. It contains several models of buttons to create quickly buttons the most used in various categories.
the list of the categories, select the category "Miscellaneous".
the list of the macro available, select macro "Test".
Access the choice offers you to show of the text or an picture on the top of the button. For this exercise, the text "Test" will be written on the button.
Click on the option Text:.
It remains only to give a name to the button.
the exercise, write " Test of macro " in the first box of the window.
Attach an existing button
He can arrive that you change opinion and want to change macro or of option for an event or a button. This part of the page shows how to change you macro and the list of the possible events with Access.
the creation mode for the form.
Click on the Event tab.
Access a possible list of the events shows you. You can attach a macro or a module to each of these events. It's so possible that Access executes a macro when you click a button or a field and a different event if you make a double clickk on the same control.
in the box in the right-hand side of the event " On click ".
When you go to press the button Test, one of both following windows will appear as the assistant of Access is shown in the screen or not.
Access offers you the opportunity to execute a macro-command at the opening of a database. This gives you the advantage to open with a macro to execute instructions. For example, you can open the database with a main menu form. You simply have to create a macro and giving it the Autoexec name. If you want to open a database without executing the autoexec macro at the opening, keep a finger on the Shift key at the time of opening the database.
|You like what you read?
Share it with your friends.