Query using 'Between [Enter Start Date] And [Enter End date]'

G

Guest

hi

in my databse iv been trying to use this criteria but doesnt pick out the
selected dates entered, for example i type in 01/02/2006 then 28/02/2006, it
picks up all the dates from 01 to 28th of every month/year instead of the 2nd
month of 2006 (Feb 2006), i cant seem to get around it, i changed the format
to short date for it to pick it up, but no luck.

can anyone help please?
 
D

Douglas J. Steele

Dates in SQL statements must be in mm/dd/yyyy format, regardless of what
you've set the Short Date format to in Regional Settings.

01/02/2006 is being picked up as 2 Jan. 28/02/2006 will be correctly
interpretted as 28 Feb, since there is no 28th month.

Take a look at Allen Browne's "International Dates in Access" at
http://allenbrowne.com/ser-36.html
or what I have in my September 2003 Access Answers column for Pinnacle
Publication's "Smart Access" newsletter. (The column and accompanying
database can be downloaded at
http://www.accessmvp.com/djsteele/SmartAccess.html)
 
W

Wayne Morgan

You can do this for any type of parameter, but it is needed for date/time
types. Open the query in design view then click on the Query menu item and
select the Parameters... option.

In the dialog, under Paramenter enter
[Enter Start Date]
and in the Data Type box enter
Date/Time

Do this for the next line also, but change the parameter to
[Enter End Date]

The parameters you list in this dialog should be exact copies of the
parameters in the query, including the brackets. This will tell the query
what the data type is for your parameter so that it will interpret it
correctly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top