LA Lawyer said:
In Access 2007, I want to create a "temporary query" in memory only so
that I can extract the ItemNo of each (or the first) record which meets
certain criteria.
How is that done?
You don't mention what you want to do with that data once you pulled it into
some "memory" structure.
The general approach is to use what we call a record-set.
For example, to pull all customer records that belong to my city, the code
would look like:
dim rstData as dao.RecordSet
set rstData = currentdb.
OpenreocrdSet("select * from tblCustomers where city =
'Edmonton'")
The real question is now that you pulled the records into rstData, what do
you want to do?
You could process all of the records like:
do while rstData.EOF = false
debug.Print rstData!AmountOwe
rstData.MoveNext
loop
rstData.Close
It just not quite clear what you want to do here. The above would return all
collums of each record. If you just wanted the "id", then you could go:
set rstData = currentdb.
OpenreocrdSet("select id from tblCustomers where city =
'Edmonton'")
Also, the above is on one line...this newsreader might be wrapping this a
bit....