How are you quering the database? Using php/asp (by using httpUtils2) or a library? If the first, you should place the code to be executed next, in a sub called from the jobDone sub. In the second case, a choice is to query using a service, then wait for its recordSet to be initialized (or fail to) and proceed with your code. This can be achieved by using a timer, yet, normally, I think that such libraries respond almost immediately.