pausing vba for refresh
it caused other problems in the program (sql syntax error).
Method1. I remember getting errors on the refresh when using Backgroundquery
= False...
It was when i would get the code from the macro recorder in the first place.
To get rid of the error, i had to comment out some lines of auto-generated
code; i believe it was some of the bellow lines (probably the SavePassword
and the SaveData) :
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
then i could run :
.Refresh BackgroundQuery:=False
Sorry i cannot rememer more than that but it was years ago.
Method2.
there is another way, but it is much more involved. It requires crreating a
Class contining a querytable member declared with the WithEvents option so
you can capture the BeforeUpdate and AfterUpdate events of the query table.
Then in your regular code module code, use an instance of that class, run the
refresh and capture the AfterUpdate event.
.... i would personaly with the first method i first described, if possible.
Method3. Use ADO, but it probably requires major changes of your current
code... may be a good method in your case, may be not...
Still, i would method 1 first.
--
Regards,
Sébastien
<http://www.ondemandanalysis.com
"westg" wrote:
Hi Sebastien,
Sorry I am using Query Tables, but you don't want to see the code, it is
huge and i am no programmer so it won't make a lot of sense!
Unfortunately I have had to stop using the Background false method because
it caused other problems in the program (sql syntax error).
Any ways around it?
|