By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,486 Members | 2,034 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,486 IT Pros & Developers. It's quick & easy.

Rst.FindNext Loop

P: n/a
Tom
Wta is the code structure to put Rst.FindNext in a loop? I'm using what I show
below. It works fine but my instinct says it should be in some standard loop
rather than using the GoTo structure.

RstTicket.FindFirst "[TicketID] = " & Me!TicketID
If RstTicket.NoMatch = False Then
<<Some Code>>

CheckForAnotherTicket:
RstTicket.FindNext "[TicketID] = " & Me!TicketID
If RstTicket.NoMatch = False Then
<<Some Code>>
GoTo CheckForAnotherTicket
End If
End If

Thanks for all help!!

Tom
Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
TC
Your instinct serves you well!

rs.findfirst ....
while not rs.nomatch
.....
rs.findnext ...
wend

HTH,
TC
"Tom" <th*******@bellsouth.net> wrote in message
news:YW******************@newsread2.news.atl.earth link.net...
Wta is the code structure to put Rst.FindNext in a loop? I'm using what I show below. It works fine but my instinct says it should be in some standard loop rather than using the GoTo structure.

RstTicket.FindFirst "[TicketID] = " & Me!TicketID
If RstTicket.NoMatch = False Then
<<Some Code>>

CheckForAnotherTicket:
RstTicket.FindNext "[TicketID] = " & Me!TicketID
If RstTicket.NoMatch = False Then
<<Some Code>>
GoTo CheckForAnotherTicket
End If
End If

Thanks for all help!!

Tom

Nov 12 '05 #2

P: n/a
Not quite ... (Please see my reply)

--
HTH
Van T. Dinh
MVP (Access)

"TC" <a@b.c.d> wrote in message news:1066804620.804729@teuthos...
Your instinct serves you well!

rs.findfirst ....
while not rs.nomatch
.....
rs.findnext ...
wend

HTH,
TC
"Tom" <th*******@bellsouth.net> wrote in message
news:YW******************@newsread2.news.atl.earth link.net...
Wta is the code structure to put Rst.FindNext in a loop? I'm using what
I show
below. It works fine but my instinct says it should be in some standard

loop
rather than using the GoTo structure.

RstTicket.FindFirst "[TicketID] = " & Me!TicketID
If RstTicket.NoMatch = False Then
<<Some Code>>

CheckForAnotherTicket:
RstTicket.FindNext "[TicketID] = " & Me!TicketID
If RstTicket.NoMatch = False Then
<<Some Code>>
GoTo CheckForAnotherTicket
End If
End If

Thanks for all help!!

Tom


Nov 12 '05 #3

P: n/a
No, you don't need the loop. FindFirst actually means find the FIRST
instance / row that matches your criteria but it will search the WHOLE
Recordset if there is no match. Thus, if the FindFirst doesn't find the
matched Record / Row, your FindNext will NEVER find it either!

--
HTH
Van T. Dinh
MVP (Access)

"Tom" <th*******@bellsouth.net> wrote in message
news:YW******************@newsread2.news.atl.earth link.net...
Wta is the code structure to put Rst.FindNext in a loop? I'm using what I show below. It works fine but my instinct says it should be in some standard loop rather than using the GoTo structure.

RstTicket.FindFirst "[TicketID] = " & Me!TicketID
If RstTicket.NoMatch = False Then
<<Some Code>>

CheckForAnotherTicket:
RstTicket.FindNext "[TicketID] = " & Me!TicketID
If RstTicket.NoMatch = False Then
<<Some Code>>
GoTo CheckForAnotherTicket
End If
End If

Thanks for all help!!

Tom

Nov 12 '05 #4

P: n/a
TC
I disagree. He clearly wants to find a matching record (if any) with
FindFirst, then find subsequent matching records (if any) with FindNext. My
suggestion does that for him. The code that he used before, was wrong. He
*says* that it worked, but my bet is that it didn't.

Perhaps he could step in & clarify (if he's still reading this)?

TC
"Van T. Dinh" <Va***********@PlseUseNewsgroup.bigpond.com> wrote in message
news:OK**************@TK2MSFTNGP09.phx.gbl...
Not quite ... (Please see my reply)

--
HTH
Van T. Dinh
MVP (Access)

"TC" <a@b.c.d> wrote in message news:1066804620.804729@teuthos...
Your instinct serves you well!

rs.findfirst ....
while not rs.nomatch
.....
rs.findnext ...
wend

HTH,
TC
"Tom" <th*******@bellsouth.net> wrote in message
news:YW******************@newsread2.news.atl.earth link.net...
Wta is the code structure to put Rst.FindNext in a loop? I'm using
what
I
show
below. It works fine but my instinct says it should be in some

standard loop
rather than using the GoTo structure.

RstTicket.FindFirst "[TicketID] = " & Me!TicketID
If RstTicket.NoMatch = False Then
<<Some Code>>

CheckForAnotherTicket:
RstTicket.FindNext "[TicketID] = " & Me!TicketID
If RstTicket.NoMatch = False Then
<<Some Code>>
GoTo CheckForAnotherTicket
End If
End If

Thanks for all help!!

Tom



Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.