ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Passing Dates criteria in MS Query (https://www.excelbanter.com/excel-discussion-misc-queries/181947-re-passing-dates-criteria-ms-query.html)

Jim Thomlinson

Passing Dates criteria in MS Query
 
You are correct with the square brackets but you need to add the prompt text
between the brackets

[Start Date] and [End Date]

--
HTH...

Jim Thomlinson


"RW" wrote:

I am trying to use MS Query to briong back data from DB2 tables. I have the
query set up in the design view. I have several sets of criteria.

Field1 = '1'
Field2 = 'Y'
Test Date Between #2/1/08# and #2/29/08

The query runs and returns the correct data.

However, I need the dates to equal 2 cells on a worksheet. I have tried
using Between [ ] and [ ] as well as Between #[ ]# and #[ ]# but neither
works.

The sql shows the date criteria as
Between {d '2008-02-01'} and {d '2008-02-29'}

I have even tried to replace the '2008-02-01' and '2008-02-29' with [ ] and
also with ? without success.

What is the proper syntax to initiate the prompts so that I can set the
parameters on cells on an excel spreadsheet?

TIA


RW

Passing Dates criteria in MS Query
 
Ok, it is now initiating prompts but I get an error message:

CLI0113E: SQLSTATE 22007 An invalid Datetime format was detected; that is,
an invalid string representation or value was specified. SQLSTATE=22007

I have tried numerous date formats, with and without #'s, 's, etc. without
success in passing the dates. Again, I am querying db2 tables.

I searched the net for CLI0113E and found the problem but not any solutions.

Any Ideas?

Thanks again.

"Jim Thomlinson" wrote:

You are correct with the square brackets but you need to add the prompt text
between the brackets

[Start Date] and [End Date]

--
HTH...

Jim Thomlinson


"RW" wrote:

I am trying to use MS Query to briong back data from DB2 tables. I have the
query set up in the design view. I have several sets of criteria.

Field1 = '1'
Field2 = 'Y'
Test Date Between #2/1/08# and #2/29/08

The query runs and returns the correct data.

However, I need the dates to equal 2 cells on a worksheet. I have tried
using Between [ ] and [ ] as well as Between #[ ]# and #[ ]# but neither
works.

The sql shows the date criteria as
Between {d '2008-02-01'} and {d '2008-02-29'}

I have even tried to replace the '2008-02-01' and '2008-02-29' with [ ] and
also with ? without success.

What is the proper syntax to initiate the prompts so that I can set the
parameters on cells on an excel spreadsheet?

TIA



All times are GMT +1. The time now is 07:07 PM.

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