change date in a sql statement from a cell

C

CAM

Hello,

I am using Excel 2007 I have a pivot table that gets refresh everyday. The
data from the pivot table is based on a sql statement, which the data is
connected to a AS/400 table. Here is my problem every morning I go in the
connection properties and change the SQLstatement (date) in the command
text. I don't want my user to do this. What other option can I do? I was
thinking change the date in a cell (A1) and somehow the SQL statement picks
up the new date or maybe some sort of parameter, but I am clueless in how to
do this. Any tips or website to visit I will appreciate. Thank you in
advance.

Regards,
 
C

colin_e

Have a look for Query Paramaters (or Parameter Queries) in the help or on
Google. I have basically the same problem myself, and this is the way I hope
to solve it. If it works it shouldn't be necessary to write any VBA code ;-)

Sadly I haven't actually had time to work on it yet, but i've had a look at
the examples and it looks good. basically you should be able to define your
SQL query with the date as a parameter that is pulled from a cell in the
sheet.

Good luck ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top