PRB: MSFlexGrid Doesn't Return All Rows w/UseODBC Data Control

Last reviewed: August 4, 1997
Article ID: Q171952
The information in this article applies to:
  • Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, version 5.0 on the following platforms: NT, Win95

SYMPTOMS

The MSFlexGrid control does not return all rows when bound to a Data control whose DefaultType is UseODBC.

RESOLUTION

All of the following are possible workarounds:

  • Change the DefaultType property of the Data control to UseJet.
  • Replace the Data control with the Remote Data Control.
  • Replace the MSFlexGrid control with the DBGrid control.

STATUS

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

MORE INFORMATION

The DefaultType property of the Data control is new to Visual Basic 5.0. It determines what type of data source (Jet or ODBCDirect) to use when creating a Recordset.

Steps to Reproduce Behavior

  1. Start Visual Basic and create a Standard EXE. Form1 is added by default.

  2. Bring up the Components dialog window by selecting the menu item Project/Components. Select "Microsoft FlexGrid Control 5.0" and click OK.

  3. Add a MSFlexGrid control (MSFlexGrid1) and a Data control (Data1) to Form1.

  4. Set the DefaultType property of Data1 to UseODBC.

  5. Set the DataSource property of MSFlexGrid1 to Data1.

  6. Add the following lines of code to the Load event of Form1:

          'Replace MY_SERVER with an appropriate SQL pubs database DSN.
          Data1.Connect = "ODBC;DSN=MY_SERVER;UID=SA;PWD="
          Data1.RecordSource = "SELECT * FROM TITLES"
          Data1.Refresh
    

          'Number of rows in the Recordset.
          MsgBox Data1.Recordset.RecordCount
    

          'Number of rows in MSFlexGrid1 excluding the title row.
          MsgBox MSFlexGrid1.Rows - 1
    

  7. Press the F5 key to run the project and note the discrepancy in the numbers displayed.
Keywords          : vb5all VBKBAX VBKBComp VBKBCtrl VBKBDB VBKBInt VBKBStd
Version           : 5.0
Platform          : NT Win95 WINDOWS
Issue type        : kbprb


================================================================================


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: August 4, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.