ExcelBanter

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

TedGrier

MS Query
 
I'm using Access 2002 to read data from SQL Server. I
have a basic query that works fine:
SELECT Count(*) From Orders WHERE SALE_DATE='6/20/2004'

Now I need the user to be able to change the date, but
cannot get the query to read a cell vaule. I think it
should work something like:

SELECT Count(*) From ORders WHERE SALE_DATE='Sheet1'!B5

Does anyone have an example of how this should be done?

THANK YOU


Michael Malinsky[_3_]

MS Query
 
I think this will work:

SELECT Count(*) From Orders WHERE
SALE_DATE=Worksheets("Sheet1").Range("B5").Value



--
Michael J. Malinsky
Pittsburgh, PA

"I am a bear of very little brain, and long
words bother me." -- AA Milne, Winnie the Pooh

"TedGrier" wrote in message
...
I'm using Access 2002 to read data from SQL Server. I
have a basic query that works fine:
SELECT Count(*) From Orders WHERE SALE_DATE='6/20/2004'

Now I need the user to be able to change the date, but
cannot get the query to read a cell vaule. I think it
should work something like:

SELECT Count(*) From ORders WHERE SALE_DATE='Sheet1'!B5

Does anyone have an example of how this should be done?

THANK YOU




TedGrier

MS Query
 
Sorry, that does not work.

What seems to ALMOST work is a [Parameter1] field, then
assigning the paramter to read values form a cell.
However, I am haveing trouble reading date values into
the parameter.

Any suggestions on how to do this?

THANKS!!!!!


-----Original Message-----
I think this will work:

SELECT Count(*) From Orders WHERE
SALE_DATE=Worksheets("Sheet1").Range("B5").Valu e



--
Michael J. Malinsky
Pittsburgh, PA

"I am a bear of very little brain, and long
words bother me." -- AA Milne, Winnie the Pooh

"TedGrier" wrote

in message
...
I'm using Access 2002 to read data from SQL Server. I
have a basic query that works fine:
SELECT Count(*) From Orders WHERE SALE_DATE='6/20/2004'

Now I need the user to be able to change the date, but
cannot get the query to read a cell vaule. I think it
should work something like:

SELECT Count(*) From ORders WHERE SALE_DATE='Sheet1'!B5

Does anyone have an example of how this should be done?

THANK YOU



.



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

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