Visual Basic Programmer
Microsoft Access Database Programmer

Custom Built Software 
Sydney, Australia

Microsoft Access: VBA Code versus Macro Commands

Microsoft Access: VBA Code versus Macro CommandsMacro Commands were developed for the Access Databases user who does not have any Visual Basic programming experience.

Macros allow Microsoft Access database functions to be invoked easily with a handful of commands. Non-programmers can easily automate simple tasks by using the Macro features.

The Macros in the latest version of Microsoft Access have been expanded with greater functionality than the original concept. This has been done mainly to replace the legacy Visual Basic for Applications (VBA).

Comparing VBA code to Macro code

Despite the improvements in Macros, there is still a huge discrepancy between the abilities of Visual Basic (VBA) code compared to Macro Commands.

  • The VBA language is a powerful programming tool. VBA provides many more features and greater flexibility than available with a Macro.
  • Macros do not have most of the control structures of VBA. The functional difference is enormous.
  • VBA can use ActiveX Data Objects (ADO) or Data Access Objects (DAO) to add, delete, update, and manipulate database records.
  • VBA can use any of the Windows API (Application Programming Interface) functions.
  • Macros cannot be stored in an ACCDE Library. The routines have to be repeated in every Front-End database.
  • VBA uses fast compiled code, whilst Macros are interpreted line by line.
  • Macros, being a separate sub-system and external to the Visual Basic code, cannot be searched with the usual Find command.
  • The Macro, unlike VBA code, has no relationship to the Form.

The Access 2010 Macros now have a Trigger event as tables are updated. VBA does not have this facility. In the rare case when a Trigger is needed, a solitary Macro could be created to handle the event.

VBA and Macros: From a Management point of view

VBA, although very powerful, is a legacy language 20 years old.

Most professional Access Database applications nowadays are being developed using the VB.Net as the programming language, rather than with Microsoft Access and VBA or Microsoft Access and Macros.

VBA cannot be used on the Web. With a SharePoint site in the Cloud, Microsoft Access can be used to create Websites. Any Access Macros are automatically converted to JavaScript.