Move through records in a QueryDef

J

Jim Pockmire

I want to create a QueryDef that selects a set of records from a table, and
then sequentually move through the records that were extracted in the
QueryDef..don't especially want to save the QueryDef in the database window.
 
J

John Spencer

It sounds as if you might want to create a record set and do something with the
records in the recordset.

Since you don't really say what you want to do as in what problem are you trying
to solve it is difficult to offer a solution. AIR CODE to do something with the
records in a recordset.

Dim DbAny as DAO.Database
Dim rstAny as DAO.Recordset
Dim StrSQL as string

Set DbAny = CurrentDb()

StrSQl = "Select Fielda, FieldB, FieldC From SomeTable Where FieldC is Null"

Set rstAny = DbAny.OpenRecordset (StrSQL)

IF rstany.Recordcount > 0 then
While not rstany.eof
rstany.edit
rstany!FieldC = rstany!Fielda & rstany!FieldB
rstany.update
rstany.movenext
Wend
end if
 

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