UI Builder's Event Logging capability can help you to capture data about how frequently specific forms or menu commands are used, or simply keep a record of user navigation activity in your database. For example, if you are making a decision about which forms in your application to retire, you may want to keep a week's record of how often users are actually accessing the form before you remove it.
Example #1 - Tracking All User Navigation Activity
In this example, ever time a user clicks on a menu item, their action will be recorded in the Event Log when the logging level is set to Debug.
- Open the module modMenu.
- Locate the function fExecuteCommand.
- Replace the following line:
Debug.Print "Execute Command " & strMenuCommand & ": " & strCommandDetail
with:
fLogEvent"Execute Command " & strMenuCommand & ": " & strCommandDetail, auiDebug, False, _
"fExecuteCommand", auiInformation
- Locate the function fExecuteSubCommand.
- Place the following line:
fLogEvent "Execute Command " & strMenuCommand & ": " & strCommandDetail, auiDebug, False, _
"fExecuteSubCommand", auiInformation
after these lines:
strMenuCommand = rstSubMenu("SubMenuItem" & iBtn & "a").Value strCommandDetail = _
rstSubMenu("SubMenuItem" & iBtn & "d").Value
Example #2 - Tracking Only Specific User Navigation Activity
In this example, only when a user selects a specific menu command will UI Builder log the action. For example, perhaps you only want to know when users open a report.
- Open the module modMenu.
- Locate the function fExecuteCommand.
- Locate the specific menu command section you want to track. For example, if you want to track any button activity that opens a subform in read only mode, you would look for the text: Case "Open Subform (read-only)"
- Insert a new line just below with the following VB code:
fLogEvent "Execute Command " & strMenuCommand & ": " & strCommandDetail, auiDebug, False, _
"fExecuteCommand", auiInformation
- Locate the function fExecuteSubCommand
- Perform Step 3 above again in this function.