Do while

ozdemirozgur

Registered User.
Local time
Today, 08:37
Joined
Apr 29, 2011
Messages
47
I have the following code which go through the first 5000 records and then stops and does not progress. please can you help

/code/
Do While Not Rem_Pos_Summary04_2000.EOF

Do While Not REM10_2000_Combined_Annualized.EOF

If ((REM10_2000_Combined_Annualized!coy_id = Rem_Pos_Summary04_2000!coy_id) And (REM10_2000_Combined_Annualized!Rem_Year = 2000) And (REM10_2000_Combined_Annualized!OO_Rem_Pos = "D")) Then

D_Sal = D_Sal + REM10_2000_Combined_Annualized!salary
Else
varstatus = SysCmd(acSysCmdSetStatus, REM10_2000_Combined_Annualized!no)
End If
REM10_2000_Combined_Annualized.MoveNext
Loop

Rem_Pos_Summary04_2000.Edit
Rem_Pos_Summary04_2000!D_2000_Salary = D_Sal
Rem_Pos_Summary04_2000.Update

REM10_2000_Combined_Annualized.MoveFirst
Rem_Pos_Summary04_2000.MoveNext
D_Sal = 0
Loop

/code/
 
I've tried to format your code to make it more readable/
Code:
Do While Not Rem_Pos_Summary04_2000.EOF

       Do While Not REM10_2000_Combined_Annualized.EOF

		If ((REM10_2000_Combined_Annualized!coy_id = Rem_Pos_Summary04_2000!coy_id) And _ 
		(REM10_2000_Combined_Annualized!Rem_Year = 2000) And _ 
		(REM10_2000_Combined_Annualized!OO_Rem_Pos = "D")) Then
		D_Sal = D_Sal + REM10_2000_Combined_Annualized!salary
		Else
		varstatus = SysCmd(acSysCmdSetStatus, REM10_2000_Combined_Annualized!no)
		End If
	REM10_2000_Combined_Annualized.MoveNext
	Loop

Rem_Pos_Summary04_2000.Edit
Rem_Pos_Summary04_2000!D_2000_Salary = D_Sal
Rem_Pos_Summary04_2000.Update

REM10_2000_Combined_Annualized.MoveFirst
Rem_Pos_Summary04_2000.MoveNext
D_Sal = 0
Loop

Do you have a jpg of your tables and relationships?
I don't see anything that would make it stop after 5000.

You are looping thru the whole table whether you have to or not.
Could be if you find a value then you could exit the inner loop_ I don't know, it's your data???
 
furthermore, what does "stop" mean? it breaks? YOU stop it? how can you tell it stops? it stops updating data?

if it stops updating data, maybe because there's nothing to update after 5000? unlikely, but certainly possible.

You've probably been staring at the screen too long. ;) More than likely, there's no issue. Gosh, if there isn't, I love it when that happens!
 
Hi,

there is no relation between the tables but a common field. the table has more than 150, 000 records and it stopps at different records at different times. What does stop mean? it means, the code is not progressing, keep waiting and waiting, nothing happens.

I tried something different. I tied to run the follwoing code which again did not progress. A simple do while with one table and just to print one of the fields when it goes through the loop. It printed until again to 500o ish record and then stopped again.

/code/
Do While Not REM10_2000_Combined_Annualized.EOF
varstatus = SysCmd(acSysCmdSetStatus, REM10_2000_Combined_Annualized!no)

REM10_2000_Combined_Annualized.MoveNext
Loop
/code/


thanks, ozgur
 
Hi,

I have thge file which is 24 Mb, the forum here allows max 2 mb after zipping but does not accept zipx files. so, I am not sure how I can send the file/

thanks, Ozgur
 
How exactly did you determine the code is not "progressing"? By staring at the Access status line? By invoking the Job Manager and seeing that Access no longe consumes CPU? By putting a counter in the code and verifying that the loop indeed stopped looping? Because if you have garbage data the thing can probably loop for a while
 
Hi,

as you see I am displaying the counter SAYI on the screen. It does not progress at all even I wait more than 1 hour atfer 10000ish data. The data is not garbage. It is a professional database and the data structure is very simple. Just two tables with a couple of fields. Any idea why it might happen ?

thanks
 

Users who are viewing this thread

Back
Top Bottom