Access MS Access 2000 Asynchronous Query

Joined
Jun 25, 2007
Messages
1
Reaction score
0
Hi,
I am trying to run an asynchronous query in Access 2000 but when it reaches the statement;
Set rsODBCDirect = connODBCDirect.OpenRecordset(sql_select, , dbRunAsync)
it stays at this point for 10 minutes while the query is executed and then moves to the next line of vb code after the 10 minutes when the query is completed). It does not send the query to be executed and continue with the execution of the vb code instantly while waiting on the results from the query. Am I doing something wrong? Thanks.

Option Compare Database
Option Explicit

Public Sub test()
Dim wkODBCDirect As Workspace, connODBCDirect As Connection, rsODBCDirect As Recordset
Dim Connection_string As String, sql_select As String

sql_select = "Select name from table1 where name not in (Select name from table2)"
Connection_string = "ODBC;Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\TEST.mdb;Uid=;Pwd=;"
Set wkODBCDirect = CreateWorkspace("", "", "", dbUseODBC)
Set connODBCDirect = wkODBCDirect.OpenConnection("", dbRunAsync, False, Connection_string)
Set rsODBCDirect = connODBCDirect.OpenRecordset(sql_select, , dbRunAsync)

While rsODBCDirect.StillExecuting
MsgBox "StillExecuting"
Wend
Debug.Print rsODBCDirect!name

rsODBCDirect.Close
connODBCDirect.Close
wkODBCDirect.Close

End Sub
 
Last edited:
Back
Top