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!

How to refresh Progress Bar while reading records

Status
Not open for further replies.

djmc

Programmer
Jun 12, 2002
179
0
0
CA
Hello,

I have a function in a module which executes to do stuff while reading a record set. It also opens a form which shows the progress of the record reading, however it is not refreshing until records have been all read.

Public Function fCheckRating()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef
Dim recordCount As Integer

' Get the total number of records.
Set db = CurrentDb()
Set rst = db.OpenRecordset("SELECT COUNT(*) FROM qryRecordSet")
recordCount = rst.Fields(0)

' Get the record set.
Set qdf = db.QueryDefs("qryRecordSet")
Set rst = qdf.OpenRecordset()

Set frmProgressWindow = New Form_frmProgressWindow
frmProgressWindow.SetFocus
DoEvents

DoCmd.Hourglass True
Application.Echo False

' Iterate through the recordset and check each one.
Do While Not rst.EOF
fCheckRecord rst
rst.MoveNext
frmProgressWindow.lblProgress.Caption = "Record "+ rst.recordCount +" of "+recordCount
frmProgressWindow.Repaint
Loop

DoCmd.Hourglass False
Application.Echo True

' Close the progress window
DoCmd.Close A_FORM, "frmProgressWindow"

' Close the database connection.
db.Close
End Function
 
Never mind, fixed it.

I accidentally used Application.Echo False and True.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top