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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows Not Responding - How to Avoid

Status
Not open for further replies.

4321z

Programmer
Oct 21, 2003
45
0
0
GB
Hi,

I'm looping 2 fairly large tables say 10000 records in one and 3000 in the other and when it runs windows says access is not responding -which it isn't windows just thinks so. But the problem i've got is i want to run a progress bar which consists of a box which grows in width and a label that shows the percent complete for the looping but this only seems to update right at the end of the process and not during it which is what my code should make it do.

Const MAX_LENGTH = 5670 '10 cm
set tables

If Table1.RecordCount > 0 Then
intNextProgressTrigger = 1
dbCurrentNumRecords = 0
intRecordCount = Table1.RecordCount
Table1.MoveFirst
Do Until Table1.EOF
If (dbCurrentNumRecords / intRecordCount) > (intNextProgressTrigger / 100) Then
bxProgress.Width = MAX_LENGTH * (intNextProgressTrigger / 100)
lblPercentComp.Caption = intNextProgressTrigger & "%"
intNextProgressTrigger = intNextProgressTrigger + 1
End If
table2 loop
dbCurrentNumRecords = dbCurrentNumRecords + 1
Table1.MoveNext
Loop
End If

tables close
 
sussed it just have to use the doEvents command
 
use doevents()

but you may also want to use mod() function in an if statement to make sure doevent() doesn't 'run' on every iteration of the loop, instead every 100th or 1000th, or some interval that you feel is appropriate.

cheers,
dan
 
oh ok, i didn't see your reply post.
dan.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top