April 2006
Beginner
1114 pages
98h 16m
English
querytable.RefreshPeriod [= setting]
Sets or returns the number of minutes between automatic refreshes. The default is 0, for no automatic refreshing. You can set automatic refreshing on synchronous or asynchronous queries. RefreshPeriod is ignored for query tables created from recordsets.
The following code creates a query table from an ODBC data source and sets the query table to refresh once a minute:
strConn = "ODBC;DRIVER=SQL Server;SERVER=.;UID=Jeff;APP=Microsoft Office " & _
"XP;WSID=WOMBAT2;DATABASE=pubs;Trusted_Connection=Yes"
strSQL = "SELECT titles.title, titles.price, titles.pubdate, titles.ytd_sales
FROM pubs.dbo.titles titles"
Set qt = ActiveWorksheet.QueryTables.Add(strConn, [QueryDestination], strSQL)
qt.RefreshPeriod = 1
qt.RefreshRead now
Unlock full access