Question : ODBC Connection to Back End Access MDB with Front End MDE

Hi --
I have an Access 2000 application which uses 2 databases.  An MDE for the front end and an MDB for the back end.  I have the admin password to log into the application.  The problem is, is that I need to create an ODBC connection to the back end database to query the tables.  When I set up the connection, I use the applications admin username and password to set up the ODBC Connection, however, I cannot connect.  Is there a way to do this?  Thanks.

Answer : ODBC Connection to Back End Access MDB with Front End MDE

You just replace the connection string with the one I referenced in line 4 of the code above. See the example in the code below.
-Chuck
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
' workgroup security ODBC
Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;SystemDB=C:\mydatabase.mdw;
 
' example of a connection
Dim cnn As ADOBE.Connection
Set cnn.ConnectionString = "Driver={Microsoft Access Driver (*.mdb)};" & _
    "Dbq=C:\mydatabase.mdb;SystemDB=C:\mydatabase.mdw;
cnn.Open
Dim strSQL As String
strSQL = "SELECT * FROM tblMyTable"
Dim rst As New ADODB.RecordSet
With rst
    .Open strSQL, cnn
     If Not .EOF Then
        ' do something with the recordset
    End If
    .Close
End With
Set rst = Nothing
Set cnn = Nothing
Random Solutions  
 
programming4us programming4us