Loop through a recordset

J

John

This is my first attempt at trying to use recordsets in code. What I want to do is loop through the records in table1.field1 and reurn to the msgbox
I'm not quite there but close

Any suggestions
Joh

Sub recordsetTemp(

Dim dbs As DAO.Databas
Dim rst As DAO.Recordse

Set dbs = CurrentD
Set rst = dbs.OpenRecordset("Table1", dbOpenTable

With rs
Do While Not .EO
MsgBox (field1
.MoveNex
Loo
End Wit

End Sub
 
W

Wayne Morgan

MsgBox (field1)

Staying with your "With" statement, try modifying the syntax of this line
to:
MsgBox (.Fields("Field1"))

Note the dot before Fields.

--
Wayne Morgan
Microsoft Access MVP


John said:
This is my first attempt at trying to use recordsets in code. What I want
to do is loop through the records in table1.field1 and reurn to the msgbox.
 

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