1 1 1 1 1 1 1 1 1 1 Rating 0.00 (0 Votes)

Problemstellung:

Für 32Bit und 64Bit Office Versionen

Wie kann ich messen wie lange ein Abfrage dauert?

Folgenden Code in öffentliches Modul kopieren:

#If VBA7 Then
    'Code für 32 bit und 64 bit Office VBA 7
     #If Win64 Then
        'Code für 64-bit Office VBA 7
        Declare PtrSafe Function GetTickCount Lib "kernel32" () As LongLong
        Dim nStart As LongLong
        Dim nEnd As LongLong
     #Else
        'Code für 32-bit Office VBA 7
        Public Declare Function GetTickCount Lib "kernel32" () As Long
        Dim nStart As Long
        Dim nEnd As Long
     #End If
#Else
    'Code für VBA 6 (32 bit)
    Public Declare Function GetTickCount Lib "kernel32" () As Long
    Dim nStart As Long
    Dim nEnd As Long
#End If

Public Function TimeShows(sAbfrage As String)
    nStart = GetTickCount()
    DoCmd.OpenQuery sAbfrage
    nEnd = GetTickCount()
    TimeShows = CStr((nEnd - nStart) / 1000)
End Function

Aufruf z.B.:

MsgBox TimeShows("Abfrage1")
 

 

Ähnliche Artikel