MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Querying ODBC

  Asked By: Qadriyah    Date: Dec 16    Category: MS Office    Views: 1441

I'm having a problem with my code running before my ODBC query
finishes. Is there a way to make the rest of the code wait until the
query finished pulling in the data?



2 Answers Found

Answer #1    Answered By: Zobebah Mizrachi     Answered On: Dec 16

You might try using either of these two methods. They work for me
depending on what I am trying to do in the program.

Place this on the line following your query.

Application.Wait Now + TimeSerial(0, 0, 5) ' Give the program time
to run before continuing. (Hours,minutes, seconds)if I remember

Program will wait  for the requested time. If time for the query
varies you may have better luck with the following:

MsgBox (" The Query is completed, Press Enter to continue")

Program will stop until you press enter.

Answer #2    Answered By: Chuong Tran     Answered On: Dec 16

Not sure if it'll work but try using DoEvents. It's in the help.

Didn't find what you were looking for? Find more on Querying ODBC Or get search suggestion and latest updates.