Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Refresh Queries in Order

I'm putting together a spreadsheet that contains multiple ODBC remote data
connections and what I'm trying to do is set up a prompt that refreshes the
data in the spreadsheet properly. The problem is that one of the remote
connections is actually a stored procedure that updates some info on a SQL
server that needs to be run before one of the other queries refreshes.

So my quesion is if there are VB commands to refresh single connections at a
time, so I can make sure they refresh in order.

I tried this code but got an error message:
Range("Data!BH4").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False

The error I get is "Run-time error '1004': Select method of Range class
failed".

I get the same error if I try to replace the "Data!BH$" part with the actual
name of the data range as well.

Just wondering if there's an easier way to do this.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Refresh Queries in Order

hi
guessing here but i don't think you need the ListObjects in your code line
to refresh a ODBC querytable. ListObjects was introduced in xl03. i have read
a little on it (ie what's new) but haven't had a chance or need to work with
it yet.
see this site
http://msdn.microsoft.com/en-us/libr...ffice.11).aspx
try the refresh with out the ListObject keyword.

Regards
FSt1

"thefonz37" wrote:

I'm putting together a spreadsheet that contains multiple ODBC remote data
connections and what I'm trying to do is set up a prompt that refreshes the
data in the spreadsheet properly. The problem is that one of the remote
connections is actually a stored procedure that updates some info on a SQL
server that needs to be run before one of the other queries refreshes.

So my quesion is if there are VB commands to refresh single connections at a
time, so I can make sure they refresh in order.

I tried this code but got an error message:
Range("Data!BH4").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False

The error I get is "Run-time error '1004': Select method of Range class
failed".

I get the same error if I try to replace the "Data!BH$" part with the actual
name of the data range as well.

Just wondering if there's an easier way to do this.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Refresh Queries in Order

hi
After looking at it again i think you have another error in the select if
you are trying to switch sheets.
try
sheets("Data").range("BH4").select
in fact, you really don't need to select.

sheets("Data").range("BH4").QueryTable.Refresh BackgroundQuery:=False

regards
FSt1

"FSt1" wrote:

hi
guessing here but i don't think you need the ListObjects in your code line
to refresh a ODBC querytable. ListObjects was introduced in xl03. i have read
a little on it (ie what's new) but haven't had a chance or need to work with
it yet.
see this site
http://msdn.microsoft.com/en-us/libr...ffice.11).aspx
try the refresh with out the ListObject keyword.

Regards
FSt1

"thefonz37" wrote:

I'm putting together a spreadsheet that contains multiple ODBC remote data
connections and what I'm trying to do is set up a prompt that refreshes the
data in the spreadsheet properly. The problem is that one of the remote
connections is actually a stored procedure that updates some info on a SQL
server that needs to be run before one of the other queries refreshes.

So my quesion is if there are VB commands to refresh single connections at a
time, so I can make sure they refresh in order.

I tried this code but got an error message:
Range("Data!BH4").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False

The error I get is "Run-time error '1004': Select method of Range class
failed".

I get the same error if I try to replace the "Data!BH$" part with the actual
name of the data range as well.

Just wondering if there's an easier way to do this.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Refresh Queries in All Worksheet AccessUser777 via OfficeKB.com Excel Programming 2 August 18th 09 08:20 PM
SPSS QUeries in Excel and refresh data mike b Excel Discussion (Misc queries) 0 April 3rd 08 09:48 PM
I cannot refresh all of the queries in my spreadsheet Peter Excel Discussion (Misc queries) 0 July 25th 06 04:23 PM
Refresh Data - Database Queries tpearo Excel Programming 0 June 27th 06 06:34 PM
Refresh queries, graphs, and charts Fredrik Wahlgren Excel Discussion (Misc queries) 1 April 1st 05 08:29 PM


All times are GMT +1. The time now is 02:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"