Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 17th, 2005, 01:11 PM
Registered User
 
Join Date: Aug 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default date range query

I am writing a query in an access database. I am having a problem using the expression builder.

I have a date field and part of the query I am trying to write is to find dates that are greater than 29 days old and less than 38 days old from the current date. I am really new at this and i think i am way way off. can anybody help me please !!!! here is what i did ..

[Qrystatus]![date1] > 29 And «Expr» < 38

the error message i get is

   data type mismatch in criteria expression
 
Old August 17th, 2005, 02:05 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Add a day field to your query like this:

DaysAgo: DateDiff("d",[YourDate],Now())

This will tell you how many days ago it was.

Then add a criteria to this field like this:

>=29 And <=38

This will limit the result to all records that are between 29 and 38 days old.

HTH

mmcdonal
 
Old August 17th, 2005, 02:14 PM
Registered User
 
Join Date: Aug 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much.. I am going to give it a shot. Because I will use this query on a regular basis, I am wondering if I will have to the current date every time i run it ..





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find a date range between another date rang tayvonne Access 2 August 3rd, 2006 09:50 AM
Date Range Flipflop SQL Language 6 November 25th, 2005 08:36 AM
Help with Date Range PacMed Access 1 February 1st, 2005 12:30 PM
Date Range mrideout BOOK: Beginning ASP.NET 1.0 0 January 2nd, 2005 07:18 PM
Query with a date range... PLEASE HELP! tlcable7 Access ASP 2 October 1st, 2003 03:41 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.