View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
mr tom mr tom is offline
external usenet poster
 
Posts: 119
Default Parameter Driven Query

Thanks Joel,

I really should have done that earlier. I'd (stupidly) assumed that a
recording macro wouldn't track my activity within MS Query.

I play about with VBA a bit, so now I've got a recorded one to play with, I
can probably work it out from here.

Thanks so much for pointing me in the right direction.

Cheers.

Tom.

"Joel" wrote:

I usally start by Recording a macro when I perform a querry. Then I modify
te querry to make it general purpose. if you post the recorded macro I can
make the modification you require.

to start a Record macro from worksheet
1) Tools - Macro - Record New Macro

2) Perform the querry

3) Tools - Macro - Stop Recording




"mr tom" wrote:

Hi,

I'm used to using MS Query to return data to Excel, but there's a whole
stack of queries that I run each month (literally, dozens) where the date
range needs to be changed.

I'm wondering whether I could put the chosen date ranges into an excel
spreadsheet, maybe in the format:

Col 1 Col 2 Col 3 Col 4
sheet query start date end date

...and use VBA to modify the SQL for me.

Alternatively, can the SQL itself be written to request a parameter from a
particular location?

Any ideas? This could be a massive time saver!

Cheers,

Tom.