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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening Access 97 & Access 2000 Tables In One Application

Status
Not open for further replies.

DJPavlik

Programmer
Jun 14, 2002
6
US
We're going through a conversion. Some tables are still in Acess 97 and we trying to migrate to Acess 2000. This is easily done in Access 2000, however, the users are not computer literate and it will be a while before everything is converted.

We're trying to write an VB6 application to open both Access 97 tables & Access 2000, making it as simple for the user's as possible.


The following code works consistently well to open the Access 97 tables but does not open the Access 2000 tables (it generates an "Unrecognizable database format" error).

Dim wrkJet As Workspace
Dim dbNameSearch As Database

' Set the name of the Access 97 file
Dim strMdbFileName As String
strMdbFileName = strCurrentFolder + strCurrentFile

Set wrkJet = CreateWorkspace("", "admin", "", dbUseJet)
Set dbNameSearch = wrkJet.OpenDatabase(strMdbFileName,False)

' strTableName is set above to name of table to be opened
Dim rsAc97 As Recordset
Set rsAc97 = dbNameSearch.OpenRecordset(strTableName)



The following code works sometime Access 97 and 2000 but not consistantly. The error for either 97 or 2000 is "Unrecognized Database Format" at the .Adodc1.Refresh command.

Dim strMdbFileName As String
strMdbFileName = strCurrentFolder + strCurrentFile
Dim strConnect As String
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" + _
"Data Source=" + strMdbFileName

' form frmEntName has and ADO AdoDc1 associated with it
' This ADo serves as the datasource for a datagrid on the
' form.
Load frmEntName
With frmEntName
.Adodc1.ConnectionString = strConnect
.Adodc1.RecordSource = strsql
.Adodc1.CommandType = adCmdText
.Adodc1.Refresh
End with

We would like the application to be smart enough to open either an Access 97 or Access 2000 table without the user having to make any unnecessary decisions.

We've applied the current service packs to the development PCs on which we're testing this, however, maybe we've missed something in that department.

Any help on this is appreciated.
 
You should use two seperate connections one using Microsoft.Jet.OLEDB.4.0 for 2000 and one using Microsoft.Jet.OLEDB.3.5 for '97.

Mark

The key to immortality is to make a big impression in this life!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top