前回から続いて。
実行計画を見ておく。
コードはこんな感じで。
Option Compare Database
Option Explicit
Declare PtrSafe Function GetTickCount Lib "kernel32" () As Long
Sub test0()
Dim i As Long, Counts As Long
For i = 1 To 10
Counts = test
Debug.Print i, Counts
Next
Debug.Print Now
End Sub
Function test() As Long
Dim dbs As DAO.Database, rs As DAO.Recordset, i As Long
Set dbs = CurrentDb
i = GetTickCount
Set rs = dbs.OpenRecordset("select * from tbl01 WHERE Code = 1000 Order By FDate desc;")
Do Until rs.EOF
rs.MoveNext
Loop
rs.Close: Set rs = Nothing
dbs.Close: Set dbs = Nothing
test = GetTickCount - i
End Function