Condividi tramite


How to: Add a Control with a Lookup Form

Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

To add a lookup form, you first add a control that is bound to a field that contains the ID of a record in a related table. The lookup form opens when you click the lookup button (Lookup button) and lists records from the related table.

The standard lookup form is added when you bind the control to a field that contains a foreign key from a table relation. The foreign key field contains the ID of the record from the related table. For information about how to create a table relation, see How to: Add a Relation to a Table.

The following steps add a control that is bound to a foreign key field in the form data source table. The control includes a lookup form that enables you to select a record from the related table.

To Add a Control with a Lookup Form

  1. In the AOT, expand Forms, and then expand the form where you want to add a control with a lookup form.

  2. Expand Data Sources, expand the table that contains the field, right-click Fields, and then click Open New Window. The Fields list opens in a new window.

  3. In the AOT that shows the form, expand Designs, and then click Design.

  4. Drag the field you want to bind to the control from the Fields list to the Design node of the form. A control is added to the Design node.

  5. Right-click the control, and then click Properties. To determine the type of control that was added, view the Type property.

    If Type is ReferenceGroup, verify that the following properties have been populated.

    Property

    Description

    Name

    Verify that the name uniquely identifies the control.

    DataSource

    Verify that the property specifies the table in the form data source that contains the field you want bound to the control.

    Label

    If you want to specify the label for the control, select the label you want to appear on the form.

    ReferenceField

    Verify that the property specifies the field in the DataSource table that contains the surrogate foreign key value.

    If Type is a StringEdit or another type of control, verify that the following properties have been populated.

    Property

    Description

    Name

    Verify that the name uniquely identifies the control.

    DataField

    Verify that the property specifies the field in the DataSource table that contains the foreign key value.

    DataSource

    Verify that the property specifies the table in the form data source that contains the field you want bound to the control.

    Label

    If you want to specify the label for the control, select the label you want to appear on the form.

    LookupButton

    Verify that the value of the property is set to Auto.

  6. Right-click the form, and then click Save.

See also

Lookup Forms Overview

How to: Add a Run-Time Lookup Form

How to: Add a Lookup Form to a Control

Best Practices for Lookup Forms

Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.