cachesize in access query

User avatar
sal21
PlatinumLounger
Posts: 4334
Joined: 26 Apr 2010, 17:36

cachesize in access query

Post by sal21 »

Have sense this cachesize statement in this query code:

Code: Select all

RST0.Close
    Set RST0 = Nothing
    Set RST0 = New ADODB.Recordset

    SQL = "SELECT DT FROM L0_SI WHERE (INT>0 OR ERO>0) GROUP BY DT"

    With RST0
        .CacheSize = 500
        .Source = SQL
        .ActiveConnection = CONN3
        .CursorLocation = adUseClient
        .CursorType = adOpenStatic
        .LockType = adLockReadOnly
        DoEvents
        .Open Options:=adCmdText
        Y = .RecordCount

        Do While Not .EOF
            Me.DT4.AddItem .Fields(0).Value
            .MoveNext
        Loop

    End With
note:
- i use adojet and access databasde

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: cachesize in access query

Post by HansV »

This can be useful if you want to loop through a large number of records, and if you are sure that the records won't be changed by another user while you are looping through them.
Best wishes,
Hans