I used the code from thread702-936087 and while it works. The progressMessage form and the frmMeterReturn_Main do display but I can't seem to get the progressMessage form to close I was getting error 2585 so I added the line on error Resume Next
Code:
Private Sub Form_Current()
DoCmd.OpenForm "FrmMeterReturn_main", acNormal, "", "", , acHidden
nill = getMeterInfo()
On Error Resume Next
DoCmd.Close acForm, "ProgressMessage"
Forms("FrmMeterReturn_main").Visible = True
Forms("ProgressMessage").Visible = False
End Sub
Public Function getMeterInfo()
Dim db As DAO.Database, rst As DAO.Recordset
Dim frm As Form, ctl As Control
Set db = CurrentDb()
Set rst = db.OpenRecordset("meterinfo", dbOpenDynaset) 'Set object reference to the Table.
rst.MoveLast
rst.MoveFirst
DoCmd.OpenForm "Progressmessage" 'Open the ProgressBar form.
DoEvents 'Allow ProgressBar form to fully refresh.
Set frm = Forms!progressmessage 'Set object reference to the ProgressBar form.
Set ctl = frm!ProgressBar7 'Set object refernce to the ProgressBar.
lblRead.Visible = True
frm.Caption = "Reading Records! . . ." 'Set the Caption of the form.
ctl.Max = rst.RecordCount 'Set the Max Count of the bar.
Do
ctl = ctl + 1 'ProgressBar is enumerated here!
rst.MoveNext
Loop Until rst.EOF
On Error Resume Next 'added this line to try and close form
DoCmd.Close acForm, "Progressmessage", acSaveNo 'Close the ProgressBar form . . . Done!
Screen.MousePointer = 0
Set rst = Nothing 'return used resources to the database (close out)
Set db = Nothing
End Function