开发者

Excel 2003 send date parameters to SQL query

开发者 https://www.devze.com 2023-01-07 22:58 出处:网络
I have a few worksheets that use sql queries to retrieve data. I would like all of these sheets to query data based on the same date range entered by a user in excel.

I have a few worksheets that use sql queries to retrieve data. I would like all of these sheets to query data based on the same date range entered by a user in excel.

eg. I would enter somewhere in a form or in a cell a date range and retrieve the value in sql to obtain data based on 开发者_JAVA技巧the user specified dates.

Is there anyway to access values from forms or from cells in SQL (Query editor perhaps)?


In MS Query (which you use to build a QueryTable) set the tick to display the Criteria grid, and for required fields enter something in brackets as a criterion value:
A screenshot http://img228.imageshack.us/img228/4593/97662427.gif

This will create two parameters in the query. Save and return to Excel, right-click the QueryTable, click Parameters... and point them to the right cells.

0

精彩评论

暂无评论...
验证码 换一张
取 消