Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / May 2007

Tip: Looking for answers? Try searching our database.

Date range for a query

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Cheese - 29 May 2007 19:34 GMT
I have set up this criteria for a date range within a query. Between [Enter
start date using format mm/dd/yyy] And [Enter end date using format
mm/dd/yyyy].  I cannot get the query or the report to pull the final date,
for example if the end date is 5/18/2007, the query will pull everything up
to 5/18/2007.  Is this because I am using the term "Between"?  What should I
use?
Cheese
KARL DEWEY - 29 May 2007 19:59 GMT
I would bet that your dates also have time in them.  Your date parameter is
not including and data that is after midnight which has a decomal fraction
added to indicate the time.
Two solutions - add an extra day.
                   - remove the fraction from the data -    
Int([YourDateField])
Signature

KARL DEWEY
Build a little - Test a little

> I have set up this criteria for a date range within a query. Between [Enter
> start date using format mm/dd/yyy] And [Enter end date using format
[quoted text clipped - 3 lines]
> use?
> Cheese
Roger Carlson - 29 May 2007 20:02 GMT
If your actual date values include the time, by putting only the date in,
you mean midnight of that date, so you lose anything on the last date.

Change the WHERE condition of your query to something like this:

WHERE DateValue([YourDateField]) Between [Enter start date using format
mm/dd/yyyy] And [Enter end date using format mm/dd/yyyy])

Of course, replace [YourDateField] with your actual field.
Signature

--Roger Carlson
 MS Access MVP
 Access Database Samples: www.rogersaccesslibrary.com
 Want answers to your Access questions in your Email?
 Free subscription:
 http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L

>I have set up this criteria for a date range within a query. Between [Enter
> start date using format mm/dd/yyy] And [Enter end date using format
[quoted text clipped - 5 lines]
> use?
> Cheese
Douglas J. Steele - 29 May 2007 20:07 GMT
Sounds as though you've populated the field in your table with both Date and
Time (perhaps you're using the Now() function, rather than the Date()
function?)

Quickest fix is to use

Between [Enter start date using format mm/dd/yyy] And ([Enter end date using
format mm/dd/yyyy] + 1)

or

Between [Enter start date using format mm/dd/yyy] And DateAdd("d", 1, [Enter
end date using format mm/dd/yyyy])

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

>I have set up this criteria for a date range within a query. Between [Enter
> start date using format mm/dd/yyy] And [Enter end date using format
[quoted text clipped - 5 lines]
> use?
> Cheese
Joan Wild - 29 May 2007 20:30 GMT
Probably because your data is actually storing both the date and time.  Between..And..5/18/2007 will get everything up to midnight the morning of 5/18/2007.  If your data includes the time, then it'll miss anything on that date.

Either don't store the time in the field, or change your criteria.  Also you should realize that what the user enters for the prompt will be interpreted according to the Regional Settings on the user's computer.  If they enter 5/12/2007 that will be interpreted as Dec 5 if their computer is set to dd/mm/yyyy.  See Allen Browne's site for working with Dates:
 http://www.allenbrowne.com/ser-36.html

Signature

Joan Wild
Microsoft Access MVP

>I have set up this criteria for a date range within a query. Between [Enter
> start date using format mm/dd/yyy] And [Enter end date using format
[quoted text clipped - 3 lines]
> use?
> Cheese
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.