Microsoft KB Archive/132548

= HOWTO: Use More Than One Table in a Combo or List Box =

Article ID: 132548

Article Last Modified on 7/13/2004

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q132548



SUMMARY
This article shows by example how to use fields from multiple tables in a combo or list box by placing a SQL SELECT command in the RowSource property.



Step-by-Step Example
 Create a new form. Open up the Data Environment and place the Products and Orditems tables in it. Select the Combo box or List box tool from the form[ASCII 146]s Control toolbar, and place a combo or list box on the form. Set the FirstElement property to 1, the NumberOfElements property to 1, and the RowSourceType property to 3-SQL Statement.  Add a SQL statement such as the following in the RowSource property: SELECT DISTINCT(padl(alltrim(orditems.product_id),2," ")) + ; "....." + products.prod_name AS prod FROM orditems, products ; INTO CURSOR items ; WHERE products.product_id = orditems.product_id ; ORDER BY prod  Run the form, and click the combo box down arrow to open up the list. The Product_id from the Orditems table will be the first thing in each line item with periods leading over to the product name (Prod_name) derived from the Products table.</ol>

Keywords: kbhowto kbcode KB132548

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.