Prev: Matching Data between 2 Tabs on Same Workbook - then calculating
Next: List of tables in SQL server database
From: CAM on 16 Mar 2010 23:14 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,
From: colin_e on 22 Mar 2010 14:05
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, > > |