View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Stephen Bullen[_4_] Stephen Bullen[_4_] is offline
external usenet poster
 
Posts: 205
Default Refresh Data Import Q

Hi John,

I have a piece of code that uses a variable to pull info from a MS Access
database (finally through the help of this newsgroup to get it to work), all
works well, except that when I change the variable and then just 'Refresh'
the data it returns is using the previous variable that I have entered. What
I have to do is delete the old query and run a new one.

I thought it would just make sense to just 'refresh' using the new variable
as I don't want my file to balloon in size, or am I doing something wrong?


How have you declared the variable? The only way it will happen automatically
is if you've used a QueryTable with a parameter linked to a cell - it'll use
the value in the cell with each refresh. If you're building the query in code,
there's no link between the QueryTable and a variable. For details about
using parameters in Query tables, see :

http://www.dicks-blog.com/archives/2...l-external-dat
a-queries/

Regards

Stephen Bullen
Microsoft MVP - Excel
www.oaltd.co.uk