csc408 management information system creating macro file · web viewa macro is a tool that allows...
TRANSCRIPT
CSC408 Management Information System Creating Macro
Macro
A macro is a tool that allows you to automate tasks and add functionality to your forms, reports, and controls. For example, if you add a command button to a form, you associate the button's OnClick event to a macro, and the macro contains the commands that you want the button to perform each time it is clicked.
In Access, it is helpful to think of macros as a simplified programming language that you write by building a list of actions to perform. When you build a macro, you select each action from a drop-down list and then fill in the required information for each action.
For example, suppose that you want to start a report directly from one of your data entry forms. You can add a button to your form and then create a macro that starts the report. The macro can either be a standalone macro (a separate object in the database), which is then bound to the OnClick event of the button, or the macro can be embedded directly into the OnClick event of the button itself — a new feature in Office Access 2007. Either way, when you click the button, the macro runs and starts the report.
Creating Macro in Access DBMS
On the Create tab, in the Other group, click Macro. If this command is unavailable, click the arrow beneath either the Module or the Class Module button, and then click Macro.
Access displays the Macro Builder.
SNI2012 Page 1
CSC408 Management Information System Creating Macro
You use the Macro Builder to build the list of actions that you want to carry out when the macro runs. When you first open the Macro Builder, the Action column, the Arguments column, and the Comment column are displayed.
You had created a lot of button for navigation for your system. The example below shows how to link button with Access object.
SNI2012 Page 2
Action: Enter an action to this column.
Action: This column displays the arguments
setting for the action.You can edit the arguments in the action
Arguments section at the bottom of the Macro Builder
Comment: Enter a comment to this column.Optional
CSC408 Management Information System Creating Macro
Example: Open and close form (Home link to Admin Menu)
SNI2012 Page 3
Button: Select the button you
would like to linkEvent: Select tab EventOn Click
Event: Click Then a new Choose
Builder dialog box will be open
Macro Builder: Select Macro
BuilderClick to
open the Macro Builder dialog box
CSC408 Management Information System Creating Macro
SNI2012 Page 4
Action: Select actionOpen Form to open a
form
Form Name: Select the form name
that you would like to perform the action
Action: Select actionClose to close a db
object
Object Type: Select the object type
that you would like to perform the action
Object Name: Select the object name
that you would like to perform the action
Close: Click