Modify macros

Microsoft Office Access 2003

  1. In the Macro window, click the first empty row in the Action column. If you want to insert an action between two action rows, click the selector for the action row just below the row where you want to insert the new action, and then click Insert Row Button image on the toolbar.
  2. In the Action column, click the arrow to display the action list.
  3. Click the action you want to use.
  4. In the lower part of the window, specify arguments for the action, if any are required. For action arguments whose settings are a database object name, you can set the argument by dragging the object from the Database window to the action's Object Name argument box.
  5. Type a comment for the action. Comments are optional.

ShowMove an action in a macro

  1. In the Macro window, click the selector for the action row.
  2. Click the selector again and drag the row to a new position.

ShowShow or hide macro names and conditions

In one macro

Do one of the following:
  • To show or hide the Macro Name column, click Macro Names Button image on the toolbar.
  • To show or hide the Condition column, click Conditions Button image on the toolbar.

In all macros by default

Change whether Microsoft Access shows the Macro Name or Condition columns by default when you create macros.

  1. On the Tools menu, click Options.

  2. Click the View tab.

  3. Under Show In Macro Design, select or clear the Names Column and Conditions Column check boxes.

ShowSet a macro to run under specific conditions

  1. In the Macro window, click Conditions Button image on the toolbar.
  2. In the Condition column, type a conditional expression in the row where you want to set the condition. You can't use an SQL expression in a macro Condition column.

    ShowTip

    In a Microsoft Access database (.mdb), click the Build Button image button to use the Expression Builder. The Expression Builder is not available from a Microsoft Access project (.adp).

  3. In the Action column, enter the action you want Microsoft Access to perform when the condition is true.

ShowEnter an expression in a macro action argument

  • Type an equal sign (=) followed by the expression.

    For example, the following expression sets the action argument to the value of the CompanyPickList control:

    =[CompanyPickList]

There are two instances in which you do not use an equal sign: the Expression argument of the SetValue action, and the Repeat Expression argument of the RunMacro action. If you precede an expression in these arguments with an equal sign, Microsoft Access evaluates the expression twice, which can cause unexpected results.

ShowTip

In a Microsoft Access database (.mdb), click the Build button Button image to use the Expression Builder. The Expression Builder is not available from a Microsoft Access project (.adp).