Move through records in a QueryDef

  • Thread starter Thread starter Jim Pockmire
  • Start date Start date
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.
 
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
 
Back
Top