Timer Function

Returns a Single representing the number of seconds elapsed since midnight.




In Microsoft Windows the Timer function returns fractional portions of a second. On the Macintosh, timer resolution is one second.


 Note   Examples that follow demonstrate the use of this function in a Visual Basic for Applications (VBA) module. For more information about working with VBA, select Developer Reference in the drop-down list next to Search and enter one or more terms in the search box.

This example uses the Timer function to pause the application. The example also uses DoEvents to yield to other processes during the pause.

Dim PauseTime, Start, Finish, TotalTime
If (MsgBox("Press Yes to pause for 5 seconds", _
        4)) = vbYes Then
    PauseTime = 5    ' Set duration.
    Start =     ' Set start time.
    Do While  < Start + PauseTime
        DoEvents    ' Yield to other processes.
    Finish =     ' Set end time.
    TotalTime = Finish - Start  ' Calculate total time.
    MsgBox "Paused for " & TotalTime & " seconds"
End If

Applies to:
Access 2007