-
Access 2000 from VB6
Hi,
How do I open an Access2000 mdb from VB6?
I have my standard data1 control on my form, the database name of which is correct but when I click on recordsource it shows an error saying "Incompatible version". I have DAO3.51, DAO3.6 and Access 9.0 references installed and I have experimented with them in different priorities but still no go!! It works ok when I get Access to convert the file to a prior Access version and then use this new mdb file. This is not an ideal situation though as you may appreciate.
Any help would be appreciated.
Thanks,
AM
-
maybe use a DSN? it is a touch slower though....
-
I have had the same problem before. You can do this one of three things to solve this.
One: Make an ODBC connection to the Access DB and then make your connection string for your DAO (this is not a very fast method)
Two: Use the ADO and make a connection using the Microsoft Jet Engine straight the Access DB you are trying to connect to.
Three: Use the ADO and ODBC connection and make your connection throught that to the Access DB.
I hope this helps if not let me know and I'll try to help you by explaining it a different way.
-
ado
ps. you are better off using the ado or dao in code. Add a module to your form or on the form_on load event do the following:
create the dsnless connection to your database e.g in ado:
Dim con1 as ADODB.Connection
Dim rstcon1 as ADODB.Recordset
Dim cmdsql as command etc
Set con1 = New ADODB.connection
con1.connectionstring = "provider=microsoft.jet.oledb.4.0;Data Source = C:\database path & location"
con1.open
Set cmdsql = new adodb.command
set cmdsql.activeconnection = con1
write sqlstmnt
create a recordset
and execute sqlstmnt
-
You mentioned
"I have DAO3.51, DAO3.6 and Access 9.0 references installed.."
Do you have all of these references on at the same time?
You should only need DAO3.6.
VB might be using 3.51 which is for Acess97.
I mean, how would it to distinguish between the two references?