|
-
April 2nd, 2001, 08:42 AM
#1
Wait for completion of Execute command
Anyone know how to pause the code until an SQL statement is finished on a database.
The problem is.. im running an SQL statement that creates a table, by querying other tables and sorting the data.
strSQL = "SELECT * INTO tmp_SelectRes IN '" & g_Scdl.ScdlFileName & "' FROM tmp_Select " & strWhere & strOrder
g_dbCatalog.Execute strSQL
Set GetInitialRS = g_Scdl.dbSchedule.OpenRecordset("tmp_SelectRes")
the strWhere and strOrder strings are developed previously in the program.
The problem is, it takes the sql statement a while to do the ORDER BY command, so when the program immediately jumps to the next line and opens the table, the data is there, just not sorted correctly. I need to wait until this sort is finished before I open the table.
HELP! please!
Thanks
Joe
-
April 2nd, 2001, 09:57 AM
#2
Re: Wait for completion of Execute command
Assuming you are using Asynchronous RDO try:
While GetInitialRS.StillExecuting
DoEvents
Wend
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
-
April 2nd, 2001, 10:00 AM
#3
Re: Wait for completion of Execute command
If in your connection you will use Client cursor (cn.CursorLocation = adUseClient) I believe that program is waiting to execute until recordset is open.
Iouri Boutchkine
[email protected]
-
April 2nd, 2001, 10:05 AM
#4
Re: Wait for completion of Execute command
Actually,
Im working on some fairly old code, probably about 3 years old now and they were using DAO
any suggestions there?
-
April 2nd, 2001, 10:21 AM
#5
Re: Wait for completion of Execute command
Nevermind on the last message. I understand what your saying... it worked fine. Thanks alot
Joe
-
April 2nd, 2001, 10:34 AM
#6
Re: Wait for completion of Execute command
if you switch to ADO and decide to use async connection, then you can use the following commands
adStateClosed Default. Indicates that the object is closed.
adStateOpen Indicates that the object is open.
adStateConnecting Indicates that the Recordset object is connecting.
adStateExecuting Indicates that the Recordset object is executing a command.
adStateFetching Indicates that the rows of the Recordset object are being fetched.
Iouri Boutchkine
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|