A Progress Meters might be exactly what you are looking for. Alternatively, I tend to use Access' Status Bar for messages that aren't significant enough to warrant a Message Box. Which might also be what you are looking for. Or maybe a combination of Both. ADezii has already pointed this out, but I thought I would include my experience. Both would use the
SysCmd Method, unless you want to use Phil's Progress Dialog, which would be something else.
What I typically do for a long process is use the following function to put a message on the Status Bar:
- 'setStatus
-
Public Sub setStatus(ByRef sStatus As String)
-
' Sets the Status Bar Text
-
If sStatus = "" Then
-
Call SysCmd(acSysCmdClearStatus)
-
Else
-
Call SysCmd(acSysCmdSetStatus, sStatus)
-
' Commented out as it will not work unless there
-
' is a Form Named Main Menu in the Project
-
'If isLoaded("MainMenu") Then
-
' Forms("MainMenu").txtSessionHistory.Value = Forms("MainMenu").txtSessionHistory.Value & vbCrLf & sStatus
-
'End If
-
End If
-
DoEvents
-
End Sub
-
-
'isLoaded
-
Function isLoaded(ByRef sFormName As String) As Boolean
-
' Determines if a Form is loaded
-
If Len(sFormName) > 0 Then
-
isLoaded = CurrentProject.AllForms(sFormName).isLoaded
-
End If
-
End Function
- An Example Call would be:
-
setStatus("Started Executing '" & sQueryName & "' at " & Now())
-
To Clear the Status:
-
setStatus("")
It will update the Status Bar as well as collect all the status messages that have been displayed into a TextBox on the Main Menu, so that at anytime, the User can review the message history... in case they were getting coffee when something significant happened.
If you wanted to include a Progress Bar, I would create a function to handle the Progress Bar, and then create an additional function that sets both the Status and the Progress.