Question : How do I connect to another database

Please tell me how to connect to a second mdb to read it's tables.

I need to specify the Workgroup, username, and password.

I am trying to use opendatabase but if there is a better way, I'll use that.

Thanks in advance.

Answer : How do I connect to another database

You can use ADO to do this:

Dim con As ADODB.Connection
Dim rst As ADODB.Recordset

Set con = New ADODB.Connection
con.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
           "Dbq=Full_Path_To_DB;" & _
           "SystemDB=Full_Path_To_Workgroup;", _
           "myUsername", "myPassword"

Set rst = New ADODB.Recordset
rst.Open "SELECT * FROM SomeTable", con

IF Not(rst.EOF and rst.BOF) Then
  '/you have records
Else
  '/you do not have records
End If
Random Solutions  
 
programming4us programming4us