I got this code for measuring the time of a query in Access database. Every time I try to run it, I get syntax error and MyTest()
line is highlighted.
Option Compare Database
Option Explicit
Private Declare Function timeGetTime _
Lib "winmm.dll" () As Long
Private mlngStartTime As Long
Private Function ElapsedTime() As Long
ElapsedTime = timeGetTime() - mlngStartTime
End Function
Private Sub StartTime()
mlngStartTime = timeGetTime()
End Sub
Public Function MyTest()
Call StartTime
DoCmd.OpenQuery "Query1"
DoCmd.GoToRecord acDataQuery, "Query1", acLast
Debug.Print ElapsedTime() & _
Call StartTime
DoCmd.OpenQuery "Query2"
DoCmd.GoToRecord acDataQuery, "Query2", acLast
Debug.Print ElapsedTime() & _
End Function
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…