Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

PRB: Refresh Method of the Intrinsic Data Control Bound to DAO 3.6 Recordset Generates Error Message 3343

View products that this article applies to.

This article was previously published under Q272622

↑ Back to the top


The intrinsic DAO data control in Visual Basic 5.0 cannot be bound directly to a Microsoft Access 2000 table. The known workaround to address this limitation is to assign a DAO 3.6 recordset object to its Recordset property at run time with Visual Basic code. The Refresh method of the intrinsic DAO data control is commonly used to refresh the bound recordset to reflect the current data in the database. In Visual Basic 5.0, if you attempt to run the Refresh method of the DAO Data control when it is bound to a DAO 3.6 Recordset, the following error message is generated:
Run-time error '3343': Unrecognized Database format.

↑ Back to the top


The intrinsic DAO data control in Visual Basic 5.0 was written to use Microsoft Jet 3.51. The use of a Refresh causes the control to close the bound recordset and reopen it to reflect the current data. Even though it is bound to a DAO 3.6 recordset at run time, the intrinsic data control attempts to reopen the recordset with the version of Jet for which it was designed (Jet 3.51) by virtue of its design, which results in the specified error being generated.

↑ Back to the top


Requery the bound DAO 3.6 Recordset and rebind it to the intrinsic DAO data control.

↑ Back to the top


This behavior is by design and is only applicable to Visual Basic 5.0 and all of its service packs up to SP3. SP3 was the last service pack released for Visual Basic 5.0. This behavior does not occur in Microsoft Visual Basic 6.0

↑ Back to the top

More information

Steps to Reproduce Behavior

  1. Open a new Standard EXE project in Visual Basic 5.0.
  2. On the Project menu, select References, and then set a reference to the Microsoft DAO 3.6 Object Library.
  3. Drag and drop an intrinsic DAO data control, a text box, and a command button onto Form1.
  4. Set the caption of the command button to Refresh DataControl and change its name to cmdRefresh.
  5. Specify Data1 (the intrinsic data control) as the DataSource of the text box.
  6. Copy and paste the following Visual Basic code into the form module. This sample uses data in the Nwind.mdb sample Access 2000 database. Change the database name, SQL query, and bound column name to point to one of your Access 2000 databases if you do not have a copy of Nwind.mdb:
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Private Sub cmdRefresh_Click()
    End Sub
    Private Sub Form_Load()
    Set db = OpenDatabase("d:\nwind.mdb")
    Set rs = db.OpenRecordset("Select * from Customers", dbOpenDynaset)
    Set Data1.Recordset = rs
    Text1.DataField = "CompanyName"
    End Sub
  7. Save the project and run it. Note that the intrinsic DAO data control is bound to the DAO 3.6 recordset, and that the text box displays the value in the specified bound column from the first record.
  8. Click Refresh DataControl to execute the Refresh method of the intrinsic data control, and note that the specified error message is generated:
    Run-time error '3343': Unrecognized Database format.
  9. Replace the code in the cmdRefresh_Click() event procedure with the following three statements:
    Set Data1.Recordset = rs
  10. Run the project, click Refresh DataControl, and note that the error message is not generated.
You can test the effect of the requery and rebind of the source DAO 3.6 recordset by the Visual Basic form if you make a change to the data in the table with Microsoft Access, and then click Refresh DataControl on the form to refresh the bound recordset.

↑ Back to the top

Keywords: KB272622, kbqfe, kbprb, kbfix

↑ Back to the top

Article Info
Article ID : 272622
Revision : 4
Created on : 12/3/2003
Published on : 12/3/2003
Exists online : False
Views : 203