help with jet 4.0

I can't get an access 2000 database to open on my machine using

db.Open(_T("Microsoft.Jet.OLEDB.4.0"), &dbinit);

Any idea?
I am using atl object wizard, and trying to make an oledb consumer using jet 4.
This works fine when I use jet 3.51

Thanks,

Bob
LVL 8
bebonhamAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Roshan DavisConnect With a Mentor Commented:
try this link

http://support.microsoft.com/support/kb/articles/Q239/7/81.asp
this contains the fix.

GOOD LUCK
0
 
bebonhamAuthor Commented:
can I see some sample code?
0
 
Roshan DavisCommented:
MSDN SAYS

SYMPTOMS
If you try to gain access to an Access 2000 database, you might experience one of the following errors within your Visual Basic program:

If you are using ADO (or the ADO Data Control):

Run-time error -2147467259 Unrecognized Database Format XXX
If you are using DAO (or the DAO generic Data Control):
Run-time error 3343 Unrecognized Database Format XXX



CAUSE
Access 2000 uses the Jet 4.0 engine, which creates Jet 4.0 format database files. Jet 3.5 components do not recognize such a format.

If you are using ADO, you get error -2147467259 when you try to connect to your Access 2000 through the "Microsoft.Jet.OLEDB.3.51" provider.


If you are using DAO, you get error 3343 above when you use the "Microsoft DAO 3.51 Object Library."


The DAO generic Data-Control does not work against Access 2000 databases, and always generates error 3343 unless 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.





RESOLUTION
To resolve this problem, do one of the following:



Install Visual Studio Service Pack 4.


For ADO (or the ADO Data Control), use the "Microsoft.Jet.OLEDB.4.0" provider.


For DAO, go to Project menu, and choose References to use the "Microsoft DAO 3.6 Object Library."


If you use the generic Data-Control, you need to open a DAO 3.6 recordset and then assign it to be the source of the Data Control as follows:



Option Explicit
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
End Sub
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.





STATUS
Microsoft has resolved this issue in Visual Studio 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. To obtain Visual Studio Service Pack 4 please visit the following web site:

http://msdn.microsoft.com/vstudio/sp

GOOD LUCK
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
bebonhamAuthor Commented:
Now I am getting the error code -2147217887

after I installed the newest version of jet and the service pack 5

this is the code I am using

void CDb11Dlg::OnOK()
{
     Csamp cb;

cb.Open();
     

     cb.MoveFirst();
     cb.Close();
}

thanks

Bob

0
 
Roshan DavisCommented:
Csamp is derived from ?

Roshmon
0
 
bebonhamAuthor Commented:
thanks for the extra help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.