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 / Queries / August 2006

Tip: Looking for answers? Try searching our database.

Need Between Dates criteria

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Uschi - 12 Aug 2006 19:44 GMT
I have been trying a write a simple between dates expression for a query.
Nothing is working. Can anyone help? Between dates 01/01/2006 and 06/30/2006.

Many thanks
fredg - 12 Aug 2006 20:29 GMT
> I have been trying a write a simple between dates expression for a query.
> Nothing is working. Can anyone help? Between dates 01/01/2006 and 06/30/2006.
>
> Many thanks

Is the Date Field is a Date/Time datatype field?
If you wish to hard code the dates, then:

Where YourTable.[DateField] Between #1/1/2006# and #6/30/2006#

If you wish the user to be able to enter the date range as needed,
then:
Where YourTable.[DateField] Between [Enter Start Date] and [Enter End
Date]

Change YourTable and DateField to whatever the actual table and date
field names are.
Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

Uschi - 12 Aug 2006 21:07 GMT
>> I have been trying a write a simple between dates expression for a query.
>> Nothing is working. Can anyone help? Between dates 01/01/2006 and 06/30/2006.
[quoted text clipped - 5 lines]
>
>Where YourTable.[DateField] Between #1/1/2006# and #6/30/2006#

I just tried that and now a prompt comes up when I run the query.

>If you wish the user to be able to enter the date range as needed,
>then:
[quoted text clipped - 3 lines]
>Change YourTable and DateField to whatever the actual table and date
>field names are.
Uschi - 12 Aug 2006 21:12 GMT
>>> I have been trying a write a simple between dates expression for a query.
>>> Nothing is working. Can anyone help? Between dates 01/01/2006 and 06/30/2006.
[quoted text clipped - 9 lines]
>>Change YourTable and DateField to whatever the actual table and date
>>field names are.
Uschi - 12 Aug 2006 21:19 GMT
>>> I have been trying a write a simple between dates expression for a query.
>>> Nothing is working. Can anyone help? Between dates 01/01/2006 and 06/30/2006.
[quoted text clipped - 9 lines]
>>Change YourTable and DateField to whatever the actual table and date
>>field names are.
When I run the query with the criteria Between "01/01/2006" AND "06/30/2006"
I will get the months and days specified but it will not give me all the
years and not just 2006.
Thank you,
Rick Brandt - 13 Aug 2006 13:33 GMT
> When I run the query with the criteria Between "01/01/2006" AND
> "06/30/2006" I will get the months and days specified but it will not
> give me all the years and not just 2006.
> Thank you,

If you use quotes (") then you get a string comparison rather than a Date
comparision.  Use # instead.

Signature

Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com

Uschi - 14 Aug 2006 05:43 GMT
>> When I run the query with the criteria Between "01/01/2006" AND
>> "06/30/2006" I will get the months and days specified but it will not
[quoted text clipped - 3 lines]
>If you use quotes (") then you get a string comparison rather than a Date
>comparision.  Use # instead.

Rick, thank you for your reply. I am revising a database created years ago by
someone else and after going around in circles all weekend on this I
discovered the problem is the Date Field in the tables. Some of Date Fields
are Text and others are Date/Time. Some have an InPut Mask, others don't.

For the tables that have date fields using (Date/Time)the query works using #,
however many of the dates look like 1_/1_/2006. The Find and Replace will not
work. Do you suggestions on how to clean this up? Any suggestions will be
greatly appreciated.
 
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.