BUG: Rebind Fails if Retrieve Fields Are Set at Design Time

Last reviewed: October 25, 1996
Article ID: Q149771
The information in this article applies to:
  • Professional and Enterprise Editions of Microsoft Visual Basic, 16-bit and 32-bit, for Windows, version 4.0

SYMPTOMS

When you execute the Rebind method after changing the data on a Data control bound to a DBGrid control with fields retrieved by clicking the right-mouse button on the DBGrid control, clicking on Retrieve Fields clears the DBGrid control but does not display the changed data.

STATUS

Microsoft has confirmed this to be an issue in the Microsoft products listed at the beginning of this article. Microsoft is researching this issue and will post new information here in the Microsoft Knowledge Base as it becomes available.

WORKAROUND

Use a Recordset to retrieve Field names instead of using Retrieve Fields from the right-click pop-up menu.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Start the 16-bit or 32-bit Visual Basic 4.0. If it is already running, on the File menu, click New Project.

  2. Add a Data control and a DBGrid Control to the Form1 form. Set the properties of the following controls:

       Control          Default Name        Property            Value
       ------------------------------------------------------------------
    
       Data Control     Data1               DatabaseName       BIBLIO.MDB
                                            RecordSource       Authors
       DBGrid           DBGrid1             DataSource         Data1
    
    

  3. Right-click on the DBGrid control and click Retrieve Fields on the menu. The Column headers on the DBGrid control contain the names of the Fields.

  4. Copy the following code to the Code window of the Form1 form:

          Option Explicit
    

          Private Sub Form_Click()
    
             'Change the RecordSource to the Titles table
             Data1.RecordSource = "Titles"
             Data1.Refresh
             DBGrid1.Rebind
          End Sub
    
    

  5. On the Run menu, click Start, or press F5. Click on the form and note that the DBGrid control is cleared of all data.


Additional reference words: 4.00 vb4win vb4all DBGrid buglist4.00
KBCategory: kbusage kbbuglist
KBSubcategory: PrgCtrlsStd




THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 25, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.