Re: Navigate subset of records



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)


.



Relevant Pages

  • Re: Isolatable Concerns
    ... In relational thinking, what is together or apart is considered a ... difficult for humans to navigate unless they reflect a familiar ... Why sprinkle SQL around, especially if its redundant? ...
    (comp.object)
  • Re: No scrolling feature in Word...
    ... Thanks for the response Graham. ... Also, within Word itself, I can't even navigate under Word Options ... Word MVP web site http://word.mvps.org ...
    (microsoft.public.word.docmanagement)
  • RE: CName & Sharepoint
    ... The problem isn't really the syntax, it is missing a level of the path, but ... "dave nixon" wrote: ... > are u using rtf or html in outlook? ... >> We have noticed that when you try to insert a file into Outlook and navigate ...
    (microsoft.public.sharepoint.portalserver)
  • Web data administrator
    ... Web Data Administrator ... using IE I navigate to http://localhost/webadmin/ ... I select the Radio button next ... to SQL then enter: ...
    (microsoft.public.sqlserver.msde)
  • Re: After Full Population, ItemCount = 0
    ... can you open a command prompt and navigate to C:\Program Files\Microsoft SQL ... > 3) No Warning messages ...
    (microsoft.public.sqlserver.fulltext)