I've used both of the techniques that Allen mentioned, as well as just
turning on the hourglass, but have found that when I'm executing a series of
queries, or am looping through a recordset (I try not to do this), that
displaying a form with a status bar is very useful to the user.
I have a form (frm_message) that contains 3 controls, a label, and two
rectangles, with the label sized to about 2" wide by 1/2" high, and put the
two rectangles right below the label. Both of the labels have their
backstyle set to normal, and the box_background has the backcolor set to
grey, while box_status has it's background set to some other color (whatever
you like).
I then have three subroutines in a code module that open the form, change
the status, and close the form.
Public Sub OpenMyMessage(Message As String, _
Optional DisplayStatus As Boolean = False)
Dim frm As Form
DoCmd.OpenForm "frm_Message", , , , , , Message
Set frm = Forms("frm_Message")
frm.InsideHeight = (0.875 + (0.25 * Abs(DisplayStatus))) * 1440
frm.InsideWidth = 2.5 * 1440
frm.lbl_MyMessage.Caption = Nz(Message, "unknown")
frm.box_Background.Visible = DisplayStatus
frm.box_Status.Visible = DisplayStatus
frm.box_Status.Width = 0
frm.Repaint
DoEvents
End Sub
Public Sub MyMessageStatus(PercentComplete As Single)
Dim frm As Form
Dim sngPercent as single
sngPercent = fnMax(fnMin(PercentComplete, 100), 0)
If CurrentProject.AllForms("frm_Message").IsLoaded Then
Set frm = Forms("frm_Message")
frm.box_Status.Width = frm.box_Background.Width * sngPercent
frm.Repaint
DoEvents
End If
End Sub
Public Sub CloseMyMessage()
If CurrentProject.AllForms("frm_Message").IsLoaded Then
DoCmd.Close acForm, "frm_Message"
End If
End Sub
This code also uses two other functions from my toolbox (fnMin and fnMax),
which ensure that I don't pass a number outside of the 0 to 100 % values to
the MyMessageStatus subroutine.
--
HTH
Dale
email address is invalid
Please reply to newsgroup only.