I've been trying to use the adExecuteAsynch option on one of my ADO commands and VB doesn't seem to recognize the constant. What's up? How do I get my recordset to keep on returning while continue on in the code?
Printable View
I've been trying to use the adExecuteAsynch option on one of my ADO commands and VB doesn't seem to recognize the constant. What's up? How do I get my recordset to keep on returning while continue on in the code?
Well, i dont think you can use your recordset until it done being populated. But here is some code that I use that seems to work for me...
Dim rs as ADODB.Recordset
Dim cn as ADODB.Connection
Dim sql as string
set cn = new ADODB.Connection
cn.Open sConnectionString
sql = "SELECT * FROM YourTable"
set rs = new ADODB.Recordset
set rs = cn.Execute(sql, , adAsyncExecute)
While cn.State = adStateExecuting
DoEvents
Wend
MsgBox "Done"
Give that a whirl and see what happens. Oh BTW, one wierd little thing with executing asyncronously, when opening a recordset, the above while loop will work, but when executing an action query (INSERT, UPDATE) use this:
While cn.State = adStateExecuting + adStateOpen
DoEvents
Wend
I don't know why, but that seems to do it. This particular property isn't using bits, so I can't use the bitwise comparison method and this is the only way i got it to work.
Good luck,
John
John Pirkey
MCSD
www.ShallowWaterSystems.com