var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Track Subform Load Times
I've got a slow form with too many subforms. Is there a simple way to track the load times of each subform?
I'm not sure in which Event and in which form(s) I should be putting a Timer and how to get the loaded subform name.
Any help is appreciated. Thanks!
if the subforms are based on queries; then with the main form open, but shrunk out of the way; manually open those queries yourself and note how long they take......
www CahabaData com
Does having the main form open affect the running queries? Also, I was hoping to have exact times and order. Some forms are multiple forms, some are regular, and they all use each other as filters. I'm curious to see how these factors affect performance as well. I'll have to do that if I can't find a way with VBA. Thanks!
no having the main form open will not affect a query time.
the reason I say to have it open - is because these queries may be looking to the main form for a parameter....if they don't then you would need this form open....but in either case it will not affect it.
you need to see how long it takes for a query(s) to run - that's the essence of the time consideration.
www CahabaData com
The succession of events when a form opens is:
Open → Load → Resize → Activate → Current
You need to acquire some start time on the Open event, acquire an end time on the Current event, then a substraction will yield the info you're looking for.
1. Create an independant module and paste this in its Declarations section:
GetTickCount calls an internal clock of the Windows operating system and returns a number of milliseconds as a Long value.
Public Declare Function GetTickCount Lib "kernel32" () As Long
2. In the Declarations section of the class module of a form you want to monitor the opening time, paste this line:
3. Create the event handler for the Open event for the form, like this:
Private lngTStart As Long
Note: If there already is a Sub Form_Open, simply add the line at the beginning of it.
Private Sub Form_Open(Cancel As Integer)
lngTStart = GetTickCount
4. Create the event handler for the Current event for the form, like this:
Note: If there already is a Sub Form_Current, simply add the line at the end of it.
Private Sub Form_Current()
Debug.Print "Form: " & Me.Name & " loaded in: " & GetTickCount - lngTStart & " milliseconds."
When the form is open then a line such as the following is printed in the immediate windows:
If you prefer to have the information in a message bos, replace the line in the Form_Current procedure with:
Form: Frm_Measures_M_Combo loaded in: 63 milliseconds.
MsgBox "Form: " & Me.Name & " loaded in: " & GetTickCount - lngTStart & " milliseconds.", vbInformation, "Form loading time"
Have a nice day!
NTC, I haven't had too many forms passing parameters, but that will save me some frustration one day.
Sinndho, that's what I was looking for!
Thanks both of you!
Tags for this Thread