ADODB Recordsets

G

Greg

I use the following command to retrieve data for current project tables.

Dim rst As ADODB.Recordset

Set rst = New ADODB.Recordset
rst.CursorLocation = adUseClient
LineNote.Open "StoredProcedureName", CurrentProject.Connection,
adOpenForwardOnly, adLockReadOnly

What I need to do is read data from a table in another Access Database. I
was able to figure this out before, but for some reason, today I'm drawing a
complete blank.

How do I change my connection form "CurrentProject" to the database I want
to read from. The other database I'm trying to read from is an Access
Database.
 
K

Kevin B

I believe you would set up another workspace. Go to your VBE and query help
on the CreateWorkspace Method
 
D

Douglas J. Steele

Try:

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

Set con = New ADODB.Connection
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\myDb.mdb;"
Set rst = New ADODB.Recordset
rst.CursorLocation = adUseClient
rst.Open "StoredProcedureName", con, adOpenForwardOnly, adLockReadOnly
 
Top