ADODB Recordsets

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
I believe you would set up another workspace. Go to your VBE and query help
on the CreateWorkspace Method
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top