QueryTable Refresh Failed

L

LynnS1982

I have an Excel vba module that loops through (several thousand) records in a
worksheet, and for each record performs a query (using Microsoft Query) to an
Access database; returning the query results to a QueryTable object in
another worksheet of the same Excel workbook. After the
QueryTable.CommandText statement, I have a QueryTable.Refresh
BackgroundQuery:=False statement.

My problem is that occasionally I receive the following error message:
Method 'Refresh' of object '_QueryTable' failed

I can restart the module at the record where it failed previously, and it
runs again correctly,for awhile, until it the Refresh method gives the same
error again.

Sometimes the module will correctly process the (same) entire set of
records, without this error message; and sometimes not.

I'm using Microsoft Office Professional Edition 2003; so this has Microsoft
Office Excel 2003 SP2 and Microsoft Office Access 2003 SP2.

Does anyone have any idea what can cause this behavior, or how I can prevent
the error from occuring, or how I can programatically recover from the error?

Thanks very much!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top