Re: Navigate subset of records
- From: "Dirk Goldgar" <dg@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 27 Jun 2007 01:24:29 -0400
In news:EC5399A4-1FF9-477C-95D2-66DA4F721423@xxxxxxxxxxxxx,
Graham <Graham@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I need to retrieve a subset of records in a specific order and I can
do that using SQL.
Having retrieved the records my problems start - I don't know the
syntax to navigate through the records and access the field values
that I am after.
Any guidance, please
Are you talking about opening a recordset on the query, and then
navigating within the recordset? That's pretty straightforward:
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset( _
"SELECT * FROM MyTable WHERE SomeField = SomeValue")
With rs
Do Until .EOF
If !MyNumberField = 123 Then
' do something
End If
If !MyTextField = "Some Text" Then
' do something else
End If
.MoveNext
Loop
.Close
End With
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
.
- Follow-Ups:
- Re: Navigate subset of records
- From: Graham
- Re: Navigate subset of records
- Prev by Date: RE: Run SQL after saving record
- Next by Date: Re: Navigate subset of records
- Previous by thread: RE: Run SQL after saving record
- Next by thread: Re: Navigate subset of records
- Index(es):
Relevant Pages
|