If you are using Microsoft ActiveX Data Objects (ADO) (or the ADO Data Control), you receive the following error message:
- If you are using ADO, you get error -2147467259 when you try to connect to your Access 2000 or 2002 database through the Microsoft.Jet.OLEDB.3.51 provider.
- If you are using DAO, you get error 3343 when you use the Microsoft DAO 3.51 Object Library.
- The DAO generic Data Control does not work against Access 2000 or 2002 databases and always generates error 3343 unless it is used as instructed in the "Resolution" section of this article. This occurs because this control is based on Jet 3.51 and only recognizes Jet 3.51 (or before) database formats.
- Install Visual Studio Service Pack 4 or later. (If you are using the Data Control, change its Connect property to Access 2000.)
- For ADO (or the ADO Data Control), use the Microsoft.Jet.OLEDB.4.0 provider.
- For DAO, add a reference to the Microsoft DAO 3.6 Object Library.
- If you use the generic Data Control, you must open a DAO 3.6 recordset and then assign it to be the source of the Data Control as follows:
Private daoDB36 As Database
Private rs As DAO.Recordset
Dim sPath As String
Private Sub Form_Load()
sPath = _
"C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb"
Set daoDB36 = DBEngine(0).OpenDatabase(sPath)
Set rs = daoDB36.OpenRecordset("Customers")
Set Data1.Recordset = rs
- This problem has been addressed by Visual Basic Service Pack 4. A new value (Access 2000) has been added for the Connect property that will allow the DAO Data Control to open Access 2000 databases.
194295 HOWTO: Tell That a Visual Studio Service Pack Is Installed
For more information on ADO and DAO, refer to the Visual Basic documentation.
For more information, query on "Unrecognized Database Format" in the MSDN Library that is supplied with Visual Basic.
Номер статьи: 238401 — последний просмотр: 17 сент. 2011 г. — редакция: 1