Wednesday, May 24, 2017

Video: Create a user interface (UI) macro

Video: Create a user interface (UI) macro

Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.

In Access 2010, macros that are attached to user interface (UI) objects such as command buttons, text boxes, forms, and reports are known as UI macros. This distinguishes them from macros that are attached to tables, which are called data macros. This video shows you the basics of creating a UI macro.

In the video

This video shows you how to create two forms, a datasheet and a detail form. Then, it shows how to add an embedded UI macro to the datasheet form, so that when you click an ID on the datasheet, the detail form opens to the appropriate record.

Create a datasheet form

If you do not already have a datasheet or other multiple-item form that you want to use, use this procedure to create one.

  1. In the Navigation Pane, select the table or query that contains the data you want on the datasheet form.

  2. On the Create tab, in the Forms group, click Datasheet.

    Access creates the form and displays it. You can begin using it immediately, or save and close the form.

Create a detail form

If you do not already have a detail or other single-item form that you want to use, use this procedure to create one.

  1. In the Navigation Pane, select the table or query that contains the data you want on the datasheet form.

  2. On the Create tab, in the Forms group, click Form.

    Access creates the form and displays it. You can begin using it immediately, or save and close the form.

Add an OpenForm UI macro to a datasheet form

  1. Open the datasheet form by double-clicking it in the Navigation Pane.

  2. If the Property Sheet is not already displayed, press F4 to display it.

  3. Click the column heading of the field that you want to add the macro to. This will be the column that you click to open the detail form when the macro is finished.

  4. On the Event tab of the Property Sheet, click in the On Click or On Dbl Click property box (depending on whether you want the form to open by single-clicking or double-clicking the field), and then click the Build button Button image .

  5. In the Action Catalog pane, in the Search box, type open.

  6. Drag the OpenForm macro action to the macro pane, or just double-click it.

  7. Fill in the arguments for the OpenForm macro action. In this video, we used the following values:

Argument

Value

Form Name

frmContactDetails

Where Condition

ID = [F orms]![ frmContactList ]![ID]

Data Mode

Edit

Window Mode

Dialog

If necessary, replace the form name (frmContactList) and the field name (ID) with the appropriate values for your forms. If you see additional arguments, just leave them blank.

  1. When you are finished filling in the argument values, on the Design tab, click Close.

  2. Close the Property Sheet pane, and then test the macro by clicking or double-clicking the field to which you added the macro.

No comments:

Post a Comment