Multiple criteria for Do While Loop

Richard McCabe

Registered User.
Local time
Yesterday, 23:42
Joined
Mar 6, 2012
Messages
19
I neeed to evaluate three criteria to determine if a timing loop should initiate or continue. The timing code which works fine is as follows:
'Do while ID < FileEnd

Do while CountEnd = "no"

Do While Timer < StartTime + TimeLimit
DoEvents
DoCmd.GoToControl ("Answr")
Loop
ElpsdTime = Timer - StartTime
DoCmd.GoToRecord , , acNext

Loop

'Loop

Criteria #1 is that the total time has not been exceeded.
Criteria #2 is that the timing function has not been disabled by a command button.
Criteria #3 is that the table containing the data has not reached the end of the file.

I can't get nested Do loops to work.

With criteria alone, the time function works properly. With criteria #1 and #2 the time function works and timing can be stopped by changing CountEnd to "Stop" with a command button. With criteria #3 in place, the counter goes through one loop and then doesn't seem to get back into the timing loop and continues to add new records.

I will look at If statements to see if I can figure something out.



Richard McCabe
 
Last edited:
Can you post some or all of your code ?

The criteria check may not need to be Looped. It could just be an If statement within your code.
 

Users who are viewing this thread

Back
Top Bottom