Compartir a través de


How to: Populate Query Results in a Form Control

If you want to display your query results in a form, you can use a table, array, or cursor to populate a grid, list box, or combo box.

To populate a list box or combo box control with a table or cursor

  1. In the Form Designer, modify the form that has the control you want to populate.

  2. Set the RowSourceType property to 3 - SQL Statement.

  3. In the control's RowSource property, enter a SELECT - SQL statement that includes an INTO TABLE or INTO CURSOR clause.

To populate a grid control with a table or cursor

  1. In the Form Designer, modify the form that has the control you want to populate.

  2. In the form's Load event, enter a SELECT - SQL statement that includes an INTO TABLE or INTO CURSOR clause.

  3. Set the grid's RecordSource property to the name of the table or cursor you created in Step 2.

  4. Set the grid's RecordSourceType property to 0 Table (for a table) or 1 Alias (for a cursor).

See Also

Tasks

How to: Run Queries (Visual FoxPro)

Other Resources

Setting Query Output Destinations

Working with Queries