ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   MS Query (https://www.excelbanter.com/excel-programming/325533-ms-query.html)

[email protected]

MS Query
 
I am writing an MS Query and it is working I'm just wondering if I can pass a
parameter to the query from the spread sheet by refrencing a cell.
Something like this
Select transamnt from gldetail where fiscalyear = $A$1
if I hardcode the year in the SQL it works fine,
I guess I can write in VBA but I was trying to take a shortcut?
Any ideas? TIA


Bob H[_2_]

MS Query
 
Try specifying a user input parameter in MS Query using [ ] as your
criteria. Return data to MS Excel (specify any valid inout when prompted).
Once back in Excel. right click somewhere in your qury results. Choose
Parameters. Specify that you want the parameter data from a specified cell
(A1). You can also optioanlly specify to automatically refresh the query
whenever the cell value changes.



" wrote:

I am writing an MS Query and it is working I'm just wondering if I can pass a
parameter to the query from the spread sheet by refrencing a cell.
Something like this
Select transamnt from gldetail where fiscalyear = $A$1
if I hardcode the year in the SQL it works fine,
I guess I can write in VBA but I was trying to take a shortcut?
Any ideas? TIA



All times are GMT +1. The time now is 10:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com