4 Main Differences between Data Macros and UI Macros in MS Access

In this article we look at the 4 Main Differences between Data Macros and UI Macros in Ms Access

Although there are several features and options in your MS Access application, one of the most used and essential feature out of all is the macros. These are important not only because they can automate task and save time, but also because they allow you to explore the option of multiple tasks that can be automated. MS Access provides you with two different kinds of macros; Data Macros and UI Macros. As the name suggests, data macros are those which work directly on the data that is stored in your Access application. UI Macros on the other hand are those which work on the user interface of the application you are using.4 Main Differences Between Data Macros And UI Macros

Apart from these basic differences, there are other differences as well, between these two types of macros, which enable the user to distinguish one from another. The 4 key differences among the two are given below.

UI Macros

  1. Data Macros And UI Macros In MS AccessSince this allows you to work on the interface of the application, you can make use of this to undertake actions like opening another view, creating new record, applying a filter, and a lot more.
  2. The UI macros which are ‘embedded’ are directly attached to the user interface. These include objects like the command button, action bar button, or the combo boxes. ‘Standalone’ UI macros on the other hand are those which are present within the object macros.
  3. The events in a control that a UI macro can be attached to are:
  • After Update: This is the event which occurs when you choose or type data from, or in a control.
  • On Click: The event that occurs when you select a control by clicking on it.
  • On Current: This event occurs when you move from one record to another in view.
  • On Load: This is the event that occurs when you load/ open view.
  1. Standalone Macros can be reused, by the use of other macros. This can help you prevent duplicate code. Standalone UI macros can be found in Navigation pane, which is found below Macros.

Data Macros

  1. These can be used for methods that can help you implement business rules on data layer. Unlike UI macros, these can be used for performing actions like creating, editing and deleting records.
  2. The ‘embedded’ macros will be found attached to table event, whereas the ‘standalone’ macros will be found contained in macro objects.
  3. The events in a table that can be used for attaching a data macro to are:
  • On Insert: This is the event that occurs when a new record has been inserted/ added in the table.
  • On Update: This is the event that occurs when changes have been made to an already existing record or.
  • On Delete – This is an even that occurs when a record has been deleted.
  1. You can make use of Standalone macros through UI macros as well as data macros by using the given RunDataMacro action. There is a possibility of these macros containing more than one parameter.

Excessive use of Macros in Access applications can even lead to incidents of data corruption and a mdb fix would serve you well if you are using MS Access for commercial projects.

Author Introduction:

Vivian Stevens is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including repair mdf and excel recovery software products. For more information visit www.datanumen.com

Comments are closed.