jwcolby
jwcolby at colbyconsulting.com
Mon Nov 5 08:45:06 CST 2007
Rocky, You need to back out from the form itself and time the "Docmd.Open" code. Start the timer just before calling docmd.open and then capture the times when that call returns. BTW as you probably know I have a class available for doing this kind of thing. The simplest class ever created that can be called a class (or so I modestly claim). Option Compare Database Option Explicit ' Private Declare Function apiGetTime Lib "winmm.dll" _ Alias "timeGetTime" () As Long Private lngStartTime As Long 'THESE FUNCTIONS / SUBS ARE USED TO IMPLEMENT CLASS FUNCTIONALITY '*+Class function / sub declaration Function EndTimer() EndTimer = apiGetTime() - lngStartTime End Function Sub StartTimer() lngStartTime = apiGetTime() End Sub '*-Class function / sub declaration Private Sub Class_Initialize() StartTimer End Sub in the code that opens your form: dim lclsTimer as clsTimer set lclsTimer = new clsTimer docmd.open ... 'open your form here msgbox lclsTimer.EndTimer John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin at Beach Access Software Sent: Monday, November 05, 2007 9:22 AM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Timing Form Open Dear List: I have a form which opens very slowly on the clients machine over a network. So I need to speed up the open. But first I need a benchmark. I tried capturing the time at the start and end of the Open event and then displaying a message box with the start, end, and elapsed times. But after I click OK on the message box there's still more stuff going on. I see Calculating... in the status at the bottom left which I think indicates that it's still evaluating the record source. And I think the slowness is from the recordsource query and/or the row sources of the combo boxes. So I need to capture the elapsed time from the very beginning to the very end of the open and load process. The start time is trivial, I think - first statement in the Open event timStart = Now. But where to I capture the stop time? If I can get the real elapsed time then I can begin to tweak the record and row sources - add indexes, simplify, etc. But I need an accurate measure of elapsed time. MTIA Rocky -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com