Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop , AddNew and Update

Status
Not open for further replies.

Therber

Programmer
Nov 20, 2000
10
US
I need to complete the following:
I have some code I need to loop thru the same number of times as records I happen to have (the number of records will change). I can use the .RecordCount for this. However, when I reach the 14th record, I need to create a new record in a separate table (using .Addnew) and then loop 14 more times thru the same code before again creating a new record and repeating. (I'm changing some Field(#'s) while in the loop and not just copying the same data.) I could have 5 records or I could have 100 records and loop thru the code
7+ times.
I need to be able to exit when the .EOF is reached and update the new records properly.

Thank You
 
I'm sure that I do not (Yet) know the full 'story' here. If you just need to do a double loop, it would easily be possible to do the outtrer loop as

While NOT rst.eof

Wend

With a simple counter and modulo function to detectevery Nth record:

MyCounter = 1
While NOT rst.eof

[tab] If (14 mod MyCounter = 0) then
[tab][tab]MyCounter = 1
[tab][tab]' Go Do Other procedure
[tab]End If

Wend
MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top