If the Choose Builder dialog box appears, make sure Macro Builder is selected, and then click OK.Īccess opens the Macro Builder. In some cases, you can recreate the functionality of the VBA procedure by using an embedded macro. You can do this by deleting the words, but you should first examine the event procedure to make sure that removing it will not break needed functionality in the database. Before you can embed a macro in the event, you will need to remove the procedure. If the property box contains the words, this means that a Visual Basic for Applications (VBA) procedure has already been created for this event. You can edit the macro by continuing with the remaining steps in this procedure. If the property box contains the words, this means a macro has already been created for this event. For example, for a command button, if you want the macro to run when the button is clicked, click in the On Click property box. In the Property Sheet task pane, click the Event tab.Ĭlick in the property box for the event you want to trigger the macro. You can also select the control or section (or the entire form or report) by using the drop-down list under Selection Type at the top of the property sheet. If the property sheet is not already displayed, press F4 to display it.Ĭlick the control or section that contains the event property in which you want to embed the macro. In the Navigation Pane, right-click the form or report that will contain the macro, and then click Layout View. Such a macro does not appear in the Navigation Pane, but can be called from events such as On Load or On Click.īecause the macro becomes part of the form or report object, embedded macros are recommended for automating tasks that are specific to a particular form or report. This procedure creates a macro that is embedded in an event property of an object. In the Save As dialog box, type a name for the macro, and then click OK.Ĭontinue with the section Add actions to a macro.
#Web user interface builder code
On the Create tab, in the Macros & Code group, click Macro. By calling the macro from other macros, you can avoid duplicating the same code in multiple places. Standalone macros are useful when you want to reuse the macro in many places of the application. This procedure creates a standalone macro object that will appear under Macros in the Navigation Pane. Here's a video that walks you through the main areas of the Macro Builder. Macro reuse The Action Catalog displays other macros you have created, letting you copy them into the one you’re working on.Įasier sharing Copy a macro, then paste it as XML into an email, newsgroup post, blog, or code sample web site. Program flow Create more readable macros with comment lines and groups of actions.Ĭonditional statements Allow for more complex logic execution with support for nested If/Else/Else If. Keyboard shortcuts Use key combinations for faster, easier macro writing. IntelliSense When typing expressions, IntelliSense suggests possible values and lets you select the correct one. Here are some of the main feature highlights of the Macro Builder.Īction Catalog Macro actions are organized by type and searchable. Depending on the context you are working in, some macro actions may not be available for use. Macro objects are visible in the Navigation Pane, under Macros embedded macros are not.Įach macro is made up of one or more macro actions. Embedded macros become part of the object or control in which they are embedded. Macros can be contained in macro objects (sometimes called standalone macros), or they can be embedded into the event properties of forms, reports, or controls. In this articleĬontrol program flow with If, Else If, and ElseĮxpand and collapse macro actions or blocks Note: This article doesn’t apply to Access web apps.