List Box Table Lookup

Description

The List Box tab of the Table Lookups form contains two list boxes.

images/object_properties_list_box.gif

Vendor Choices for List Box 

The Field Properties Choices tab of the List Box displays the Vendor_Name field and stores the Vendor_No field from the Vendor table. The records are sorted alphabetically by Vendor_Name.

images/object_properties_list_box_vendor_choices.gif

Procedure 

  1. Select the list box and right click.

  2. Click the Properties ... selection.

  3. Click the Choices tab.

  4. In the Choices for control are field, select "Computed Automatically".

  5. In the Source field, select "Values from a table/set".

  6. In the From Table field, select "vendor".

  7. In the Field/expression values to display field, enter " Vendor_Name + "|" + Vendor_No ". This expression returns two fields: Vendor_Name, which is displayed, and Vendor_No, which is stored.

  8. In the Display order field, select "Vendor_Name". This sorts the records alphabetically on the Vendor_Name field.

  9. Click the OK button to return to the Form Editor.

Product Choices for List Box 

The Field Properties Choices tab of the List Box displays the Product_Name field and stores the Product_No field from the Product table. The records are sorted alphabetically by Product_Name.

images/object_properties_list_box_product_choices.gif

Procedure 

  1. Select the list box and right click.

  2. Click the Properties ... selection.

  3. Click the Choices tab.

  4. In the Choices for control are field, select "Computed Automatically".

  5. In the Source field, select "Values from a table/set".

  6. In the From Table field, select "product".

  7. In the Field/expression values to display field, enter " Product_Name + "|" + Product_No ". This expression returns two fields: Product_Name, which is displayed, and Product_No, which is stored.

  8. In the Display order field, select "product_name". This sorts the records alphabetically on the Product_Name field.

  9. Check the Enable Filter Expression check box and click the Edit Filter Expression button.

    • Product Filter for List Box 

      In addition, the Product_Name records are limited to those where Product_Vendor_No field equals Quote_Vendor_No_OP1. A change in the Quote_Vendor_No_OP1 field triggers a refresh of the Product list.

      images/object_properties_list_box_product_filter.gif
  10. In the Field Expression (in target table) field, enter "Product_Vendor_No".

  11. In the Operator field, select "=".

  12. In the Field Expression (in current table) field, select "Quote_Vendor_No_Op1".

  13. In the Watch Expression field, select "Quote_Vendor_No_Op1".

  14. In the Display order field, select "product_name".

  15. Click the OK button to return to the Field Properties dialog box.

  16. Click the OK button to return to the Form Editor.

The Table Lookups sample database can be downloaded.

See Also