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
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