local recordset in acess

K

kimi

i need to create a recordset by looping through the contents of a local
access table.
how do I go about this?

do I connect to the local table via ado or odbc to create the recordset
or is there anoy method when working with local tables in the current
access db?

thank you in advance
 
K

kimi

I figured it out...


Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "[agent]", CurrentProject.Connection, adOpenKeyset,
adLockOptimistic

If Not rs.EOF Then
Do While Not rs.EOF
MsgBox (rs.Fields("agent").Value)
rs.MoveNext
Loop
End If
 
G

Guest

In my experience DAO outperforms ADO within an Access project.

Dim db ' as DAO.Database
Dim rs ' as DAO.Recordset

Set db = currentdb
Set rs = db.openrecordset("agent")

with rs
do until .eof
msgbox .fields("agent")
.movenext
loop
end with
 

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

Top