MS Query Variable

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an Excel workbook with over sixty data pages, each with an MS Query accessing an external database. I have to open all of the queries to manually input a new date. I can use a variable in the criteria field, but is there any way to pass the new date once and have all the queries 'read' it

Thanks.
 
Type a date in an empty cell on the worksheet.
Instead of typing a date in the query, enter a parameter. For example:
[What Date?]

Then, select a cell in the query results, and click the Query Parameters
button
Choose 'Get the value from the following cell'
Click in the reference box, then click on the cell that contains the date.
Check the 'Refresh automatically' box
Click OK

Set the parameters for each query to refer to the cell that contains the
date.
When you change the date, the queries will be refreshed.
 
The Query Parameters is grayed out...I think it's because I'm connected to a DB2 database because when I connect to SQL databases, I don't have any problem. I'm writing VB code right now to work around this, but I thought maybe someone might have a quicker solution

Thanks for your response

----- Debra Dalgleish wrote: ----

Type a date in an empty cell on the worksheet
Instead of typing a date in the query, enter a parameter. For example
[What Date?

Then, select a cell in the query results, and click the Query Parameters
butto
Choose 'Get the value from the following cell
Click in the reference box, then click on the cell that contains the date
Check the 'Refresh automatically' bo
Click O

Set the parameters for each query to refer to the cell that contains the
date
When you change the date, the queries will be refreshed


Brenda wrote
 
Back
Top