Wiki Home

RowSourceType


Namespace: WIN_COM_API
Used to specify the type of source for the values in a control.

Syntax: control.rowsourcetype[ = nSource]

The settings for the RowSourceType property are:

Setting Description
0 - (Default) None. Use .AddItem or AddListItem method.
1 - Value. A comma-delimited list.
2 - Alias. Use the ColumnCount property to select fields in the table.
3 - SQL Statement.
4 - Query (a .qpr file)
5 - Array. Use .columns for multiple dimensions.
6 - Fields. A comma delimited list.
7 - Files from the current directory. Specify file skeleton (such as *.dbf or *.txt) or mask in the .RowSource.
8 - Structure. Fields from the table specified in .RowSource

From the Hackers Guide
Be careful with RowSourceType s 2 and 6. They're connected right to the underlying tables, and moving the cursor in the list moves the record pointer. Among other things, this means that you should never set the RowSource and the Control Source of a type 6 combo to the same field.

It's not just making a choice in a combo that moves the record pointer. Simply passing the mouse over an item in a dropped combo so that the item is highlighted is enough to position the record pointer on that item. The pointer doesn't go back where it came from if you close the combo without making a selection.

Common Errors:
With RowSourceType of 6 - Fields, a "Field Phrase Not Found" error during instantiation of the form is often the result of the RowSource having the table alias on more than the first field.

Correct: Customer.name, city, country

Incorrect: Customer.name, Customer.city, Customer.country

Applies to: Combo Box, List Box
Category VFP Control Properties
( Topic last updated: 1999.10.05 11:44:03 AM )