What is a macro?

A macro is a stored series of commands that carry out an action or a string of actions. This feature can be used to add functionality or automate simple tasks, such as performing an action when the user clicks a command button.

Why use macros?

You do not need to know how to program to use macros!

Macros can perform a number of the common tasks that you can also use Visual Basic code to perform. With some research, non-programmers can quickly set up a macro and dramatically increase database productivity.

Limitations of macros

Macros functions are limited. You might find yourself searching for some help developing a custom VB code. Macros lack programming loops and advanced coding logic.

Macros are not meant to be a permanent solution, and they take up more space than VB code. Luckily, you can use this function to develop prototype VBA code.

Most professional Access developers use the VBA programming language for a richer and more powerful development environment. Over time, you’ll want to switch your Macro over to a VB code.

Using Visual Basic code rather than macros gives you much more flexibility and power. Visual Basic provides much more functionality than macros such as returning values or iterating through record sets.

Examples of macros

The following Macro contains examples of:

  • Variable declaration
  • Referencing cells in a Worksheet
  • Select Case Statement

Example of Macro Code

Developing Macros

If you do not have a programming background, you can use the macro feature to automate simple tasks through a series of drop down selections that Access has provided.

Macros allow you to easily chain commands together such as running queries, importing or exporting data, opening and closing forms, previewing and printing reports, etc. Macros support basic ‘IF condition’ logic and the ability to call other macros. Macros can also contain sub-macros which are similar to subroutines.

In Access 2007, macros are significantly enhanced with the inclusion of error handling and temporary variable support. Access 2007 also introduces embedded macros that are essentially properties of an object's event. This eliminates the need to store macros as individual objects.

Designing a Macro >

  • Judicial Attorney Services Inc.

    You continue to do a job well done with the design, updating and maintenance of our company's program. Work is performed in a timely and professional manner.

    - President

  • A Trucking and Warehousing Company

    Their ability to understand our industry from the ground up - just like one of my coworkers would - is their key differentiator.

    - Customer Service Manager

  • A Services Company

    I needed to believe that Access Programmers could help my company. Their team understood my hesitation and took the time to really understand my business needs.

    - Regional Sales & Operations

  • A Non-Profit Advocacy Firm

    Access Programmers has completed several projects for us - all of which we've been extremely satisfied with. The staff is very knowledgeable, accessible, professional and easy to work with.

    - Information Technology Manager

Contact Us

Please wait...