Show user record nums as they are processed

J

Johnny Bright

Hi there,

What I want to do is show my users that something is happening when they are
processing large numbers of records, upwards of 1,000,000 at times so they
can see that something is going on.

I have tried the following:

Dim conn As ADODB.Connection
Set conn = CurrentProject.Connection
Dim Frst As New ADODB.Recordset
Dim TotalRecords As Long
Dim RecordNum As Long
Dim Feedback As String

RecordNum = 0

Frst.Open "Select * From ClientData", conn, adOpenKeyset,
adLockOptimistic
TotalRecords = Frst.RecordCount

Do Until Frst.EOF


RecordNum = RecordNum + 1

Feedback = "Processing " & RecordNum & " of " & TotalRecords

SysCmd acSysCmdSetStatus, Feedback

Frst.MoveNext
Loop

Frst.Close
Set Frst = Nothing
This sort of works in the sense that the status bar is changing but it
changes so fast, it's unreadable.

I have tried creating a label or a text box such as:

me.lblTotal.caption=RecordNum

If I do this in the forms open event with my Total Records variable, I can
get this number but I need it to show which record the db is working on. Is
this even possible or are there any other suggestions?

Thanks!

John
 
J

John W. Vinson

This sort of works in the sense that the status bar is changing but it
changes so fast, it's unreadable.

I presume SOME sort of processing is going on that you don't post - otherwise
you're just wasting time and CPU cycles looping through the recordset!

Try displaying only in 100 or 1000 record blocks:

Do Until Frst.EOF


RecordNum = RecordNum + 1

If RecordNum MOD 100 = 0 Then
Feedback = "Processing " & RecordNum & " of " & TotalRecords

SysCmd acSysCmdSetStatus, Feedback

End If

Frst.MoveNext
Loop

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top