Place the fLogEvent function call at each key point in your code where you want to evaluate potential bottlenecks. For example, before and after every major time you initiate a query, macro, or import/export.
Function ProcessSomething()
fLogEvent "Starting processing - running query 'some query'", auiDebug, False, "ProcessSomething", auiInformation
DoCmd.OpenQuery "some query"
fLogEvent "Done running 'some query', running query 'another query'", auiDebug, False, "ProcessSomething", auiInformation
DoCmd.OpenQuery "another query"
fLogEvent "Done running 'another query', running macro 'macro1'", auiDebug, False, "ProcessSomething", auiInformation
DoCmd.RunMacro "macro1"
fLogEvent "Done running macro 'macro1', running 'macro2'", auiDebug, False, "ProcessSomething", auiInformation
DoCmd.RunMacro "macro2"
fLogEvent "Done running macro 'macro2', running 'macro3'", auiDebug, False, "ProcessSomething", auiInformation
DoCmd.RunMacro "macro3"
fLogEvent "Done running macro 'macro3', function complete.", auiDebug, False, "ProcessSomething", auiInformation
End Function
In this case, each log event captured will
display the text specified, like "Starting process..." and the timestamp.
You can then easily do a visual scan through a given process set and see
which particular stages of processing are taking the longest. Best
of all, you can turn on the Debug logging from
the back-end database, and view the logs without having to be at the
user's PC.
Once you have activated event logging and are using it in your own code, you can open the event log viewer as shown above, to review major events in your database, filtering by type of event, user, machine, and source.