473,749 Members | 2,432 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Rst.FindNext Loop

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.FindF irst "[TicketID] = " & Me!TicketID
If RstTicket.NoMat ch = False Then
<<Some Code>>

CheckForAnother Ticket:
RstTicket.FindN ext "[TicketID] = " & Me!TicketID
If RstTicket.NoMat ch = False Then
<<Some Code>>
GoTo CheckForAnother Ticket
End If
End If

Thanks for all help!!

Tom
Nov 12 '05 #1
4 16342
TC
Your instinct serves you well!

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

HTH,
TC
"Tom" <th*******@bell south.net> wrote in message
news:YW******** **********@news read2.news.atl. earthlink.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.FindF irst "[TicketID] = " & Me!TicketID
If RstTicket.NoMat ch = False Then
<<Some Code>>

CheckForAnother Ticket:
RstTicket.FindN ext "[TicketID] = " & Me!TicketID
If RstTicket.NoMat ch = False Then
<<Some Code>>
GoTo CheckForAnother Ticket
End If
End If

Thanks for all help!!

Tom

Nov 12 '05 #2
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*******@bell south.net> wrote in message
news:YW******** **********@news read2.news.atl. earthlink.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.FindF irst "[TicketID] = " & Me!TicketID
If RstTicket.NoMat ch = False Then
<<Some Code>>

CheckForAnother Ticket:
RstTicket.FindN ext "[TicketID] = " & Me!TicketID
If RstTicket.NoMat ch = False Then
<<Some Code>>
GoTo CheckForAnother Ticket
End If
End If

Thanks for all help!!

Tom


Nov 12 '05 #3
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*******@bell south.net> wrote in message
news:YW******** **********@news read2.news.atl. earthlink.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.FindF irst "[TicketID] = " & Me!TicketID
If RstTicket.NoMat ch = False Then
<<Some Code>>

CheckForAnother Ticket:
RstTicket.FindN ext "[TicketID] = " & Me!TicketID
If RstTicket.NoMat ch = False Then
<<Some Code>>
GoTo CheckForAnother Ticket
End If
End If

Thanks for all help!!

Tom

Nov 12 '05 #4
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***********@ PlseUseNewsgrou p.bigpond.com> wrote in message
news:OK******** ******@TK2MSFTN GP09.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*******@bell south.net> wrote in message
news:YW******** **********@news read2.news.atl. earthlink.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.FindF irst "[TicketID] = " & Me!TicketID
If RstTicket.NoMat ch = False Then
<<Some Code>>

CheckForAnother Ticket:
RstTicket.FindN ext "[TicketID] = " & Me!TicketID
If RstTicket.NoMat ch = False Then
<<Some Code>>
GoTo CheckForAnother Ticket
End If
End If

Thanks for all help!!

Tom



Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2940
by: Charles Alexander | last post by:
Hello I am new to php & MySQL - I am trying to retrieve some records from a MySQL table and redisplay them. The data in list form looks like this: Sample_ID Marker_ID Variation G23_NA17192.fsa rs7374540 A/C I23_Control.fsa rs7374540 C/C
5
7301
by: Martin Schou | last post by:
Please ignore the extreme simplicity of the task :-) I'm new to C, which explains why I'm doing an exercise like this. In the following tripple nested loop: int digit1 = 1; int digit2 = 0; int digit3 = 0; for( ; digit1 < 5 ; digit1++ ) {
2
2682
by: Alex | last post by:
Compiler - Borland C++ 5.6.4 for Win32 Copyright (c) 1993, 2002 Borland Linker - Turbo Incremental Link 5.65 Copyright (c) 1997-2002 Borland Platform - Win32 (XP) Quite by accident I stumbled across some wierd loop behavior. With the pasted code I receive the output that follows. I realize that the code is broken, because the inner loop fails to reset j for each iteration of the outer loop (the fix is commented out). I also know that...
9
3377
by: John Hernry | last post by:
I have been watching the dotnet newsgroups for a couple of weeks now and scouring the net looking for a solution to my datagrid find functionality. With no luck. I am hoping that you can help me. I am an old VB6 coder used to using Sheridan controls, and I am just starting to learn the .net world. I am upgrading my music catalogue database, where the data is stored in an Access mdb file.
32
2598
by: cj | last post by:
When I'm inside a do while loop sometimes it's necessary to jump out of the loop using exit do. I'm also used to being able to jump back and begin the loop again. Not sure which language my memories are of but I think I just said loop somewhere inside the loop and it immediately jumped back to the start of the loop and began again. I can't seem to do that in .net. I this functionality available?
1
6720
Corster
by: Corster | last post by:
I went through a great deal of hassle to figure this out for myself, but now it is complete, I would like to share it with the world! I know afew other people have had trouble with FindFirst and FindNext, so I hope this will be helpful! 'This is the counter to help with FindNext Dim vblCnt As Integer Private Sub btnSearch_Click() On Error GoTo Err_btnSearch_Click Dim vblSearch As String Dim vblRSC As Recordset
1
3203
by: shiznaw | last post by:
How can I attach the findnext method to a spinbutton so that the control can browse through the values of a particular field? Private Sub SpinButton4_SpinUp() Dim mjr As Recordset Set mjr = Me.Major_Link() DoCmd.FindNext
7
3846
by: BUmed | last post by:
Well, in need to find a record using a command button so I set up a FindRecord in a macro. Now the person wants to be able to find all the records that meet the last name criterian so I thought I would use FindNext but as I found out you cant do that because the focus shifts so it starts over. The help menu said to use a custom Toolbar button. But I don't know what that is and I'm not all that good at VBA programing could yous help. thanx Steve
2
19314
ADezii
by: ADezii | last post by:
If you are executing a code segment for a fixed number of iterations, always use a For...Next Loop instead of a Do...Loop, since it is significantly faster. Each pass through a Do...Loop that iterates a specified number of times, requires you to also implement or decrement some sort of Loop Counter, while a For...Next Loop does that work for you. Both Loops will provide the same results, but the For...Next Loop is substantially faster. One...
0
8997
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8833
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9568
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9256
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8257
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6801
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3320
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2218
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.