Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prompting for Date

Status
Not open for further replies.

TheGus

Technical User
Jan 14, 2005
5
IE
Using MSQuery, how do I ask the user to enter two dates for the start and finish of a BETWEEN statement?
I have tried
Code:
WHERE ENDDT BETWEEN '#' & [Enter Start Date] & '#','#' & [Enter End Date] & '#'
but I get an error!

Can anyone help?
 
The between command doesn't use a comma, it uses and, and you don't need to mess around with the #'s
Code:
WHERE ENDDT BETWEEN [Enter Start Date] and [Enter End Date]

hth

Ben

----------------------------------------------
Ben O'Hara "Where are all the stupid people from...
...And how'd they get so dumb?"
rockband.gif
NoFX-The Decline
----------------------------------------------
Want to get great answers to your Tek-Tips questions? Have a look at F
 
I had it like that originally but it kept complaining that the date format was bnot correct even though it exactly matched the output of the date from other queries?
 
Enter your date with the following format:
#m/d/yyyy#
ie #1/15/2005# for today.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Or define your parameters explicitly.
In the qde choose Query->Parameters menu item then enter
[Enter Start Date] and [Enter End Date] as date/times and the PC should convert your parameters according to the local machine settings.
Your SQL will look like
Code:
PARAMETERS [Enter Start Date] DateTime, [Enter End Date] DateTime;
....Rest of SQL...

hth

Ben

----------------------------------------------
Ben O'Hara "Where are all the stupid people from...
...And how'd they get so dumb?"
rockband.gif
NoFX-The Decline
----------------------------------------------
Want to get great answers to your Tek-Tips questions? Have a look at F
 
PHV,
I got a ORA-01858: a non-numeric value was found where a numeric value was expected

Ben,
It will only let me choose VARCHAR2 as the data type!
 
You may try the standard ANSI way for date:
yyyy-mm-dd

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Is this a pass-through query to oracle or is it based on tables linked to an oracle database?

----------------------------------------------
Ben O'Hara "Where are all the stupid people from...
...And how'd they get so dumb?"
rockband.gif
NoFX-The Decline
----------------------------------------------
Want to get great answers to your Tek-Tips questions? Have a look at F
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top