Results 1 to 6 of 6

Thread: speed up query execution

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Mar 2005
    Posts
    2,928

    speed up query execution

    for you wath code speed up the query execution:
    Code:
    ....
    SQL = "SELECT SP from tab1 WHERE DT='" & Me.DT3.Text & "'GROUP BY SP"
    ....
    Set RST0 = New ADODB.Recordset
        With RST0
            .CursorType = adOpenKeyset
            .CursorLocation = adUseClient
            .LockType = adLockReadOnly
        End With
    
        Set CMD = New ADODB.Command
        With CMD
            .CommandTimeout = 0
            .CommandText = SQL
            .ActiveConnection = CONN
            .CommandType = adCmdText
            '.Prepared = True
            DoEvents
            Set RST0 = .Execute
            Set CMD = Nothing
        End With
    ....
    or directlly:

    Code:
      With RST0
            .CursorType = adOpenKeyset
            .CursorLocation = adUseClient
            .LockType = adLockReadOnly
        End With
    Set RST0= New ADODB.Recordset
        RST0.Open sql, CONN, adOpenKeyset, adLockOptimistic, adCmdtext
    note:

    are approx 75.xxx records in access table:-(
    Last edited by luca90; Nov 19th, 2011 at 04:00 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width