[AccessD] Time in milliseconds

John Colby jcolby at colbyconsulting.com
Wed Jun 25 18:56:00 CDT 2003


I'll send you a demo.

John W. Colby
www.colbyconsulting.com

  -----Original Message-----
  From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Rocky Smolin -
Beach Access Software
  Sent: Wednesday, June 25, 2003 7:53 PM
  To: accessd at databaseadvisors.com
  Subject: Re: [AccessD] Time in milliseconds


  John:

  Thanks again for your help.

  Ran into a little problem with the ten times opening approach.  It seems
that the just-in-time stuff must be triggering by the opening because there
was no difference between the two forms (the one with the source and the one
without) and the 'calculating...' thingy was displayed at the bottom of the
screen in both cases.

  I'll work on it tomorrow.

  Thanks again.

  Rocky

    ----- Original Message -----
    From: John Colby
    To: accessd at databaseadvisors.com
    Sent: Wednesday, June 25, 2003 4:04 PM
    Subject: RE: [AccessD] Time in milliseconds


    You pasted the code into a module instead of a class?  Or you saved the
class code to a name other than clsTimer.

    John W. Colby
    www.colbyconsulting.com

      -----Original Message-----
      From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Rocky Smolin -
Beach Access Software
      Sent: Wednesday, June 25, 2003 6:45 PM
      To: accessd at databaseadvisors.com
      Subject: Re: [AccessD] Time in milliseconds


      John:

      That looks real good.  The time kind of got away from me so if I don't
get a reply right away I can go with what I've got.  But this would be
better.

      I'm getting a compile error on

      Dim mclsTimer As clsTimer

      User defined type not defined.

      What have I left out?

      Best,

      Rocky



        ----- Original Message -----
        From: John Colby
        To: accessd at databaseadvisors.com
        Sent: Wednesday, June 25, 2003 10:13 AM
        Subject: RE: [AccessD] Time in milliseconds


        Rocky,

        Below is a modification to the TestTimer to time your form opening /
closing 10 times.  Obviously replace the form name(s) with your own.

        Option Compare Database
        Option Explicit
        Dim mclsTimer As clsTimer

        Function TestTimer()
        Dim intLoopCnt As Integer
        Set mclsTimer = New clsTimer
            For intLoopCnt = 1 To 10
                DoCmd.OpenForm "frm_MoviesTab"
                DoCmd.Close acForm, "frm_MoviesTab"
            Next intLoopCnt
            MsgBox mclsTimer.EndTimer & " ms elapsed time - Hit any key to
continue", , "TIMER TEST 1"
            mclsTimer.StartTimer
            For intLoopCnt = 1 To 10
                DoCmd.OpenForm "frm_MoviesTab"
                DoCmd.Close acForm, "frm_MoviesTab"
            Next intLoopCnt
            MsgBox mclsTimer.EndTimer & " ms elapsed time - Hit any key to
continue", , "TIMER TEST 1"
            Set mclsTimer = Nothing
        End Function


        John W. Colby
        www.colbyconsulting.com

          -----Original Message-----
          From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Rocky Smolin -
Beach Access Software
          Sent: Wednesday, June 25, 2003 11:37 AM
          To: accessd at databaseadvisors.com
          Subject: Re: [AccessD] Time in milliseconds


          John:

          Will it work across forms?

          I'm demonstrating your Just-In-Time forms at the AUGSD tonight and
since it's a single user box the difference in opening time is hard to see,
even though it's a factor of 2-4.

          I think I need to start my timing from the Main Menu Click event
that opens the form with the sub-forms in it, as some of the processing of
loading the sub-form's recordsets goes on even before the called form's
OnOpen event.

          Best,

          Rocky



            ----- Original Message -----
            From: John Colby
            To: accessd at databaseadvisors.com
            Sent: Wednesday, June 25, 2003 6:47 AM
            Subject: RE: [AccessD] Time in milliseconds


            Rocky,

            Here is the class I use for timing things such as the opening of
forms and such, with a timer test function you can place in a module to play
around with the class.  Dead simple to use.

            The nice thing about using a class is that you can have as many
instances as you need timing various stuff since the variable tracking
elapsed time is private to the class instance.

            Option Compare Database
            Option Explicit
            Dim mclsTimer As clsTimer

            Function TestTimer()
            Set mclsTimer = New clsTimer
                MsgBox "Hit any key to continue", , "TIMER TEST 1"
                MsgBox mclsTimer.EndTimer & " ms elapsed time - Hit any key
to continue", , "TIMER TEST 1"
                MsgBox mclsTimer.EndTimer & " ms total elapsed time - Hit
any key to continue", , "TIMER TEST 2"
                mclsTimer.StartTimer
                MsgBox "Hit any key to continue", , "TIMER TEST 3"
                MsgBox mclsTimer.EndTimer() & " ms elapsed time", , "TIMER
TEST3"
                Set mclsTimer = Nothing
            End Function


            Option Compare Database
            Option Explicit

'.===============================================================
            '.Copyright 2001 Colby Consulting.  All rights reserved.
            '.E-mail       : jcolby at colbyconsulting.com

'.===============================================================
            ' DO NOT DELETE THE COMMENTS ABOVE.  All other comments in this
module
            ' may be deleted from production code, but lines above must
remain.

'---------------------------------------------------------------------
            '.Description  : Implements the instantiated class for: clsTimer
            '.
            '.Written By   : John W. Colby
            '.Date Created : 05/28/2001
            ' Rev. History :
            '
            ' Comments     :

'---------------------------------------------------------------------
            '.
            ' ADDITIONAL NOTES:
            '

'---------------------------------------------------------------------
            '
            ' INSTRUCTIONS:

'---------------------------------------------------------------------
            '.
            'THESE CONSTANTS AND VARIABLES ARE USED INTERNALLY TO THE CLASS
            '*+ Class constant declaration
            '*- Class constants declaration

            '*+ Class variables declarations
            '*- Class variables declarations

            'THESE CONSTANTS AND VARIABLES ARE USED BY THE CLASS TO
            'IMPLEMENT CLASS FUNCTIONALITY
            Private Declare Function apiGetTime Lib "winmm.dll" _
                                                Alias "timeGetTime" () As
Long
            '*+ custom constants declaration
            '*- Custom constants declaration

            '*+ custom variables declarations
            Dim lngStartTime As Long
            '*- custom variables declarations

            'THESE FUNCTIONS / SUBS ARE USED INTERNALLY TO THE CLASS
            '*+ Private Init/Terminate Interface
            Private Sub Class_Initialize()
                StartTimer
            End Sub
            '*- Public Init/Terminate interface
            '*- Parent/Child links interface
            'THESE FUNCTIONS / SUBS ARE USED TO IMPLEMENT CLASS
FUNCTIONALITY
            '*+Class function / sub declaration
            Function EndTimer() As Long
                EndTimer = apiGetTime() - lngStartTime
            End Function

            Sub StartTimer()
                lngStartTime = apiGetTime()
            End Sub
            Function RawTime() As Long
                RawTime = apiGetTime()
            End Function
            '*-Class function / sub declaration


            John W. Colby
            www.colbyconsulting.com

              -----Original Message-----
              From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Rocky Smolin -
Beach Access Software
              Sent: Tuesday, June 24, 2003 12:08 AM
              To: AccessD at databaseadvisors.com
              Subject: [AccessD] Time in milliseconds


              Dear List:

              Is it possible to access/store/display the time in increments
smaller than seconds.  I need to time something in fractions of a second.

              MTIA

              Rocky



--------------------------------------------------------------------


            _______________________________________________
            AccessD mailing list
            AccessD at databaseadvisors.com
            http://databaseadvisors.com/mailman/listinfo/accessd
            Website: http://www.databaseadvisors.com



------------------------------------------------------------------------


        _______________________________________________
        AccessD mailing list
        AccessD at databaseadvisors.com
        http://databaseadvisors.com/mailman/listinfo/accessd
        Website: http://www.databaseadvisors.com



----------------------------------------------------------------------------


    _______________________________________________
    AccessD mailing list
    AccessD at databaseadvisors.com
    http://databaseadvisors.com/mailman/listinfo/accessd
    Website: http://www.databaseadvisors.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030625/0e9a536f/attachment-0001.html>


More information about the AccessD mailing list