SQLConfiguration SQLConfiguration





Access Macros  «Prev 

Using Access Macro Builder

Access Macro Builder
Access Macro Builder consisting of 1) Macro Name, 2) Action, 3) Comment, and 4) Action Arguments

  1. Macro Name, This is where you type the name of the macro.
  2. Action, This is a list of macro Actions from which you can select.
  3. Comment, This column is used for documenting your macros. By documenting your macros you can remember what the purpose was for the macro and also help others who have to help maintain the macro.
  4. Action Arguments, Action Arguments specify the parameters used with each action. They will change based on the Action you choose.



Embedded Macros in Access

An embedded macro is a macro object that is stored directly in an event property for a form, report, or control.
These macros have two advantages over VBA and macro objects.
  1. If you have ever copied a control that had code behind it and then wished that the code also was duplicated, this feature is for you.
    Because these macros are part of a control's properties, the macro that is associated with a control event is also copied.
  2. You no longer need separate macro objects that perform small, simple one-off tasks. These macros can be associated directly with an event property.
To create an embedded macro, choose Macro Builder from an event property's Choose Builder dialog box. Once you create the macro, the event property changes to [Embedded Macro].
To take advantage of these benefits, the wizards in Access 2010 are updated to create embedded macros in the new format database (ACCDB). This is because VBA code is not allowed to execute in Disabled mode, meaning that wizard-generated code would not run unless a database is trusted.
By using macros, the wizards now allow the application to run as much as possible in Disabled mode without failing. For backward compatibility, VBA code is still created using the wizards in the previous file formats (MDB and ADP), but they have been updated to use the RunCommand method where appropriate.
That's right, the wizards no longer create code that calls DoMenuItem.