- database solutions and downloads for microsoft access

Microsoft Access Macros

Types of Macros in Microsoft Access:

When working in your database application, often the same tasks may be performed repeatedly. Rather than having your database users perform the same steps each time, you can automate the process with different types of macros in Microsoft Access.

Access macros automate many repetitive tasks without your having to write complex programs or subroutines in VBA.

A macro is an object like other objects available in Microsoft Access (tables, queries, reports etc.), except that you create the macro to automate a particular task or series of tasks.

Typically, macros on Microsoft Access forms can be grouped into categories depending on the function that they perform; the macros in each category contain unique instructions that enable them to perform the indicated tasks.

  • Validating Data: You can create macros in Microsoft Access to require that data be entered into a control, or to display a custom dialog box that prompts the database user for additional information.
  • Setting Values: A powerful use for macros in a user entry form is to have the macro set the value for the control, field or property. This can make data entry tasks much easier and provide more accuracy.
  • Filtering, Finding and Printing Records: These types of macros can automate the process of filtering, finding and printing of information. A custom dialog box can be displayed to initiate the process specific to the user's needs.
  • Navigation between Forms and Records: This type of macro moves to a specific control, record or page in a form.

A macro in Microsoft Access is essentially a list of actions, applied to an object in the database (be it a form, textbox control, command button, etc.) that will respond to certain events. Each of these actions that you specify in the macro design carries out one task. The actions will need to be created in the order that you wish them to execute. Whilst creating the required actions, you can also specify arguments for them, which will give the application any additional information that is needed.

Macro conditions can also be set for each of the macro actions, and these can be used to determine whether the macro will run or not (testing whether the condition is True or False). The macro is then ran by attaching it to the event property of an object. When the specified event occurs, the macro will run the actions assigned to it. If any of the actions have had macro conditions applied to them, they will run providing that they have passed the conditional tests.

The Author

Ramesh Gupta originally from New Delhi, India is now working as a freelance developer and lives in Boston, MA. He has designed and worked on numerous databases for previous companies and has experiences in many Microsoft technologies including Microsoft Access, Microsoft Excel, SQL Server and VB.NET.