Microsoft KB Archive/269037

= BUG: DataCombo Loses BoundText When Recordset Re-Queried =

Article ID: 269037

Article Last Modified on 10/15/2002

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft ActiveX Data Objects 2.5
 * Microsoft ActiveX Data Objects 2.6
 * Microsoft ActiveX Data Objects 2.7

-



This article was previously published under Q269037



SYMPTOMS
When you re-query a recordset, then binding a new recordset or otherwise resetting the RowSource property on a DataCombo control causes the BoundText property of a DataCombo to return the Text property.



RESOLUTION
To work around the problem, set the DataCombo.Text property to itself as follows: DataCombo1.Text = DataCombo1.Text



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
 Create a form in the Visual Basic form editor with three command buttons, a DataCombo control, the ADO data control, and a ListBox control.  Add the following code to the form: Private Sub Command1_Click ' First show that the BoundText displays a number List1.AddItem DataCombo1.BoundText End Sub Private Sub Command2_Click ' Now it displays a name! ' This is where we break the bindings and display the results ' When command1 executes DataCombo1 will show datacombo1.text ' instead of datacombo1.boundtext. Adodc1.Refresh Command1_Click End Sub Private Sub Command3_Click ' Here we implement the fix. DataCombo1.Text = DataCombo1.Text Command1_Click End Sub Private Sub Form_Load ' You may need to change the path in the following ' line to point to NWIND.MDB Adodc1.ConnectionString = &quot;Provider=Microsoft.Jet.OLEDB.4.0;&quot; & _ &quot;Data Source=E:\Program Files\Microsoft Visual Studio\VB98\NWIND.MDB&quot; Adodc1.RecordSource = &quot;Employees&quot; DataCombo1.BoundColumn = &quot;EmployeeID&quot; DataCombo1.ListField = &quot;LastName&quot; Set DataCombo1.RowSource = Adodc1 Set DataCombo1.DataSource = Adodc1 DataCombo1.Text = &quot;1. Select a name&quot; Command1.Caption = &quot;2. List BoundText&quot; Command2.Caption = &quot;3. Requery Recordset&quot; Command3.Caption = &quot;4. Reset BoundText&quot; End Sub  Run the program, and follow the numbered captions.

Keywords: kbbug kbdatabinding kbdatabase kbpending KB269037

-

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

© Microsoft Corporation. All rights reserved.