Hey everyone,
In Excel VB I have a querytable that I use to send update queries to a SQL server. It is embedded in a for loop that sends thousands of queries. Each time through the for loop, the query is constructed, and I use the command
varSQL is the UPDATE query. After this, I need to call
to make the update query actually run. Now my issue is I cannot have this query refreshing in the background, so after this refresh I call
Sometimes, the refresh is not finished when it cancels, and the update is not actually stored in the database. Is there any way to make Excel wait for the refresh to finish once before canceling the background refresh? I've tried many things, and unfortunately
is not an option. Thanks!
In Excel VB I have a querytable that I use to send update queries to a SQL server. It is embedded in a for loop that sends thousands of queries. Each time through the for loop, the query is constructed, and I use the command
Code:
Sheet3.QueryTables(1).CommandText = varSQL
Code:
Sheet3.QueryTables(1).refresh
Code:
Sheet3.QueryTables(1).cancelrefresh
Code:
.refresh backgroundquery:=true