![]() |
change date in a sql statement from a cell
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, |
change date in a sql statement from a cell
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 ;-) "CAM" wrote: 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, |
All times are GMT +1. The time now is 08:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com