The update process runs the queries one by one. Initial settings on form open are set within the update code (some of it deprecated by me). Code below.
Form design view (header removed for proprietary reasons). There is an image control with dbl click event in the form header in case it fails to close and needs to be closed by an admin. The close button is only to be used at the end of the process (users are aware) mainly due to the fact that when queries are running, program control flips over to Jet and forms don't react right away to such things as button clicks anyway.
view showing overlapping controls positioned for explanation. Bottom one is a blue rectangle (I might have suggested a textbox in error).
Code:
DoCmd.OpenForm "frmUpdate"
Set lbl = Forms!frmupdate.lblUpdateStatus 'message about what data is being returned
Set lbl2 = Forms!frmupdate.lblStatus 'notifies percentage of completion
Set rec = Forms!frmupdate.recStatus 'blue progress bar
lbl2.Visible = False 'turned off 09/17/2014
'''lbl2.Caption = "0% complete"
rec.Width = 0
lbl.Caption = ""
DoCmd.RepaintObject acForm, ("frmUpdate")
There are 7 updating steps, typical:
Code:
step2:
lngCustErr = 10020
With lbl
.ForeColor = vbWhite
.Caption = "GETTING REQUISITION DATA..."
End With
rec.Width = 525
DoCmd.RepaintObject acForm, ("frmUpdate")
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryReqnData", , acReadOnly
lngCustErr tells a Select Case block in the error handler code exactly which step(s) generate any errors. The pause is for allowing control to come back to the form momentarily (from Jet) so that the form view will refresh reliably. You simply pass a number you think provides a safe but minimal lag.
Code:
Public Function Pause(sngSecs As Single)
Dim Start As Variant
Start = Timer
Do While Timer < Start + sngSecs
DoEvents
Loop
End Function