Microsoft KB Archive/146118

= PRB: Duplicate Column Appears in Combo or List Box =

Article ID: 146118

Article Last Modified on 9/30/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition

-



This article was previously published under Q146118



SYMPTOMS
Setting the RowSourceType of a combo box or list box to 6-Fields or 2-Alias and then either concatenating the first two fields together or using a function, such as UPPER, on the first field causes the object to duplicate the data from the first column into the second column.



WORKAROUND
Use an SQL-ELECT statement to select the data before placing it in the object when you want to concatenate fields or use functions with data. For example, the following SQL-SELECT statement places the city and phone fields into the first column and the postalcode field into the second column: SELECT city+phone,postalcode FROM customer INTO CURSOR TEMP You need to type this SQL-SELECT statement into the RowSource property, and change the RowSourceType to 3-SQL Statement.

You can also place certain functions (such as UPPER, LTRIM, and RTRIM) in a SQL-SELECT statement. However, other functions, like SUBSTR, give an error when placed in a SQL-SELECT statement.

Another option is to use an array or the AddItem method to populate the combo box or list box. For more information about populating an object by using the AddItem method, please see the following article in the Microsoft Knowledge Base:

137183 How to Add Items to a Multiple-Column Combo Box



STATUS
Microsoft is researching this behavior and will post new information here in the Microsoft Knowledge Base as it becomes available.



Steps to Reproduce Behavior
 Create a form called test. Add the Customer table from the TestData database located in the Samples\Data subdirectory under Visual FoxPro to the Data Environment. Place a combo box on the form.  In the properties sheet of the Combo box, set the following properties:   BoundColumn = 2 ColumnCount = 2 ColumnWidths = 150,150 RowSource = city+phone,postalcode RowSourceType = Fields  Run the form. The combo box duplicates the data from the first column to the second column in every row. The second field does not appear.</li></ol>

Additional query words: VFoxWin

Keywords: KB146118

-

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

© Microsoft Corporation. All rights reserved.