Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB - MSAccess

Status
Not open for further replies.

rann

Programmer
Sep 13, 2001
86
0
0
US
HI,
I was trying to create a form in VB connected to a
Access table.I used the below code to connect the form
to a Access table.


Private Sub Form_Load()
Dim db as Connection
set sb = new Connection
db.open "PROVIDER= Microsoft.Jet.OLEDB.3.51;Data source= c:\Data.mdb;"
.....
....
..
End Sub

I get an error in 'db.open' (line# 3 in above code) it works fine for some older
versions such as access 97 but it gives me an error when i try
connect with access2000.do any one know why i am getting this error. I even tried the Data control to connect but the same problem.

Error:
Run time error '-2147467259(80004005)':
unrecognized database format 'c:\Data.mdb',

Any help will be appreciated,

Thanks in Advance,
Ran



 
Yes, you should be using "Microsoft.Jet.OLEDB.4.0"
 
Hi,
Thanks for your help.
Where Can i get the jet 4.0 upgrade file.
Can you please give me some links.

Thanks again,
Ran.
 
uh, not my realm, really.
are you refreshing and requerying and all that?

anyone else?

scarfhead
 
Have you tried to do an ADO connection?

I am a fan of ADO since I use it all the time to connect to Access.

Try this out:
Code:
Dim cn as ADODB.Connection
Set cn = New ADODB.Connection
cn.CursorLocation = adUseClient or 
cn.CursorLocation = adUseServer

strCNText = "Provider=Microsoft.Jet.OLEDB.4.0;Data  Source=C:\data.mdb"

cn.open strCNText

This should work well if you like ADO

Hope this helps.
Mavors
Cincinnati, Ohio
 
He is using ADO, he's just referencing the wrong (old) provider. If you have Access 2000 installed on that machine, you should have Jet 4.0 available. If you don't, you should download it from Microsoft.com.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top