Connecting to Access 97 Database using ADO with OLE DB Driver 
Author Message
 Connecting to Access 97 Database using ADO with OLE DB Driver

I am trying to connect to Access 97 database using ADO with Microsoft
Jet 3.51 OLE DB Provider but I get an error that the "Test Connection
failed because of an error in intializing provider. Can't open a
database created with a previous version of your application.". However
if convert the database into Access 2000 I can open it. Is there some
other OLE DB drivers I need to get for Access 97 files.
Any help will be appreciated.

Thanks

Raj



Tue, 26 Mar 2002 03:00:00 GMT  
 Connecting to Access 97 Database using ADO with OLE DB Driver
Here is the code that I used to connect to ACCESS97 via ADO and all works
fine.

I have this code in a class named CLOGIN

------------

'----------------------------------------------------------------------
' Module Name:  CLOGIN
' Author:       Clint M. LaFever

'
' Description:  CLOGIN Class - Interface to log into database using
'                   ADO 2.0
'
'----------------------------------------------------------------------
Option Explicit
Public DataBaseName As String
Public ServerName As String
Public UserName As String
Public Password As String
Public cn As ADODB.Connection
Public Enum DATABASE_TYPES
    SQL_SERVER = 0
    MS_ACCESS97 = 1
End Enum
Public Function ConnectRemote(Optional dbTYPE As DATABASE_TYPES = 0) As
Boolean
On Error GoTo ConnectRemote_Error
    Dim sConnect As String
    If dbTYPE = SQL_SERVER Then
        sConnect = "DRIVER={SQL Server};SERVER=" & Me.ServerName _
            & ";UID=" & Me.UserName & ";PWD=" & Me.Password & ";DATABASE=" &
Me.DataBaseName & ";"
    Else
        sConnect = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" &
Me.DataBaseName & ";"
    End If
    Set cn = New ADODB.Connection
    cn.Open sConnect
    If cn.State = adStateOpen Then
        ConnectRemote = True
    Else
        ConnectRemote = False
    End If
    Call SaveSetting(App.Title, "Startup", "ConnectionVersion", cn.Version)
    Call SaveSetting(App.Title, "Startup", "LastConnected", Now)
    ConnectRemote = True
ConnectRemote_Exit:
    Exit Function
ConnectRemote_Error:
    Call SaveSetting(App.Title, "StartUp", "LastError", Err & ":" &
Err.Description)
    ConnectRemote = False
    Resume ConnectRemote_Exit
End Function

--------------

------------------------------------------
Clint M. LaFever
Lead Software Engineer
SAIC Decision Support Division
1235 Jefferson Davis Hwy, Suite 411
Arlington, VA 22202
703-413-8991 (wk)
703-413-6058 (fax)

http://www.saic.com

------------------------------------------

Quote:

>I am trying to connect to Access 97 database using ADO with Microsoft
>Jet 3.51 OLE DB Provider but I get an error that the "Test Connection
>failed because of an error in intializing provider. Can't open a
>database created with a previous version of your application.". However
>if convert the database into Access 2000 I can open it. Is there some
>other OLE DB drivers I need to get for Access 97 files.
>Any help will be appreciated.

>Thanks

>Raj



Tue, 26 Mar 2002 03:00:00 GMT  
 Connecting to Access 97 Database using ADO with OLE DB Driver
Hi Clint,
Thanks for the Info. It shall help. My only problem is that it is secured access
database. I am not sure if it makes a difference. I used the same connection
string. But also had the System, UserId and Password. So I am not sure if the
System.mdw is creating the problem. My driver was also oledb.3.51. I will try to
connect with OLE.DB to an un secured database and see if it works.

Thanks again for the info.

Raj

Quote:

> Here is the code that I used to connect to ACCESS97 via ADO and all works
> fine.

> I have this code in a class named CLOGIN

> ------------

> '----------------------------------------------------------------------
> ' Module Name:  CLOGIN
> ' Author:       Clint M. LaFever

> '
> ' Description:  CLOGIN Class - Interface to log into database using
> '                   ADO 2.0
> '
> '----------------------------------------------------------------------
> Option Explicit
> Public DataBaseName As String
> Public ServerName As String
> Public UserName As String
> Public Password As String
> Public cn As ADODB.Connection
> Public Enum DATABASE_TYPES
>     SQL_SERVER = 0
>     MS_ACCESS97 = 1
> End Enum
> Public Function ConnectRemote(Optional dbTYPE As DATABASE_TYPES = 0) As
> Boolean
> On Error GoTo ConnectRemote_Error
>     Dim sConnect As String
>     If dbTYPE = SQL_SERVER Then
>         sConnect = "DRIVER={SQL Server};SERVER=" & Me.ServerName _
>             & ";UID=" & Me.UserName & ";PWD=" & Me.Password & ";DATABASE=" &
> Me.DataBaseName & ";"
>     Else
>         sConnect = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" &
> Me.DataBaseName & ";"
>     End If
>     Set cn = New ADODB.Connection
>     cn.Open sConnect
>     If cn.State = adStateOpen Then
>         ConnectRemote = True
>     Else
>         ConnectRemote = False
>     End If
>     Call SaveSetting(App.Title, "Startup", "ConnectionVersion", cn.Version)
>     Call SaveSetting(App.Title, "Startup", "LastConnected", Now)
>     ConnectRemote = True
> ConnectRemote_Exit:
>     Exit Function
> ConnectRemote_Error:
>     Call SaveSetting(App.Title, "StartUp", "LastError", Err & ":" &
> Err.Description)
>     ConnectRemote = False
>     Resume ConnectRemote_Exit
> End Function

> --------------

> ------------------------------------------
> Clint M. LaFever
> Lead Software Engineer
> SAIC Decision Support Division
> 1235 Jefferson Davis Hwy, Suite 411
> Arlington, VA 22202
> 703-413-8991 (wk)
> 703-413-6058 (fax)

> http://www.saic.com

> ------------------------------------------


> >I am trying to connect to Access 97 database using ADO with Microsoft
> >Jet 3.51 OLE DB Provider but I get an error that the "Test Connection
> >failed because of an error in intializing provider. Can't open a
> >database created with a previous version of your application.". However
> >if convert the database into Access 2000 I can open it. Is there some
> >other OLE DB drivers I need to get for Access 97 files.
> >Any help will be appreciated.

> >Thanks

> >Raj



Tue, 26 Mar 2002 03:00:00 GMT  
 Connecting to Access 97 Database using ADO with OLE DB Driver
Raj,
If your access 97 database is passworded I don't think you can use OLE DB
for jet providers.  I could never get it to work and if I recall correctly
it is a bug.  To get around it, I created an ODBC connection and used the
OLE DB provider for ODBC.  That seemed to work.  Good luck.
Bruce Hendry
Quote:

>I am trying to connect to Access 97 database using ADO with Microsoft
>Jet 3.51 OLE DB Provider but I get an error that the "Test Connection
>failed because of an error in intializing provider. Can't open a
>database created with a previous version of your application.". However
>if convert the database into Access 2000 I can open it. Is there some
>other OLE DB drivers I need to get for Access 97 files.
>Any help will be appreciated.

>Thanks

>Raj



Fri, 29 Mar 2002 03:00:00 GMT  
 Connecting to Access 97 Database using ADO with OLE DB Driver
Raj,

If your database has security, you will need to let the provider know the
location of your workgroup information file. Add the following to your
connection string:

    Jet OLEDB:System database=C:\data\mysytem.mdw"

or set the connection property like this Microsoft sample:

   Dim cnn As New ADODB.Connection
   cnn.Provider = "Microsoft.Jet.OLEDB.4.0;"
   cnn.Properties("Jet OLEDB:System database") = _
      "C:\Program Files\Microsoft Office\Office\SYSTEM.MDW"
   cnn.Open "Data Source=.\NorthWind.mdb;User Id=Admin;Password=;"

Good Luck,
Roy

Quote:

> Hi Clint,
> Thanks for the Info. It shall help. My only problem is that it is
secured access
> database. I am not sure if it makes a difference. I used the same
connection
> string. But also had the System, UserId and Password. So I am not sure
if the
> System.mdw is creating the problem. My driver was also oledb.3.51. I
will try to
> connect with OLE.DB to an un secured database and see if it works.

> Thanks again for the info.

> Raj

------------------  Posted via CNET Help.com  ------------------
                      http://www.help.com/


Sun, 31 Mar 2002 03:00:00 GMT  
 Connecting to Access 97 Database using ADO with OLE DB Driver
Roy,

I am having the same issue, but I would like to resolve it using the data
control.  Is this possible?  If so, what do I need to do?

Ted

Quote:

> Raj,

> If your database has security, you will need to let the provider know the
> location of your workgroup information file. Add the following to your
> connection string:

>     Jet OLEDB:System database=C:\data\mysytem.mdw"

> or set the connection property like this Microsoft sample:

>    Dim cnn As New ADODB.Connection
>    cnn.Provider = "Microsoft.Jet.OLEDB.4.0;"
>    cnn.Properties("Jet OLEDB:System database") = _
>       "C:\Program Files\Microsoft Office\Office\SYSTEM.MDW"
>    cnn.Open "Data Source=.\NorthWind.mdb;User Id=Admin;Password=;"

> Good Luck,
> Roy


> > Hi Clint,
> > Thanks for the Info. It shall help. My only problem is that it is
> secured access
> > database. I am not sure if it makes a difference. I used the same
> connection
> > string. But also had the System, UserId and Password. So I am not sure
> if the
> > System.mdw is creating the problem. My driver was also oledb.3.51. I
> will try to
> > connect with OLE.DB to an un secured database and see if it works.

> > Thanks again for the info.

> > Raj

> ------------------  Posted via CNET Help.com  ------------------
>                       http://www.help.com/



Sun, 31 Mar 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Connecting to Access 97 Database using ADO with OLE DB Driver

2. How to use OLE DB/ ADO with Access 97

3. Connect to AS400 using ADO and OLE DB

4. Problem writing to Access 97 DB with ADO 1.5 and 2.1 (using ODBC)

5. ADO Update (using VB) of Memo fields in Access 97 DB

6. Sending text to Word 97 from Access 97 using OLE automation

7. ADO Query into Access 97 Database using VB6

8. ADO Query into Access 97 Database using VB6

9. error messages reported by OLE DB /ADO with Access 2000 database at an internet server

10. Connect 16-bit VB app to 32-bit Access 97 DB

11. Help, using an Access 97 DB without MS Access Application

12. Help, using an Access 97 DB without MS Access Application

 

 
Powered by phpBB® Forum Software