Excluding Dates problem - syntax

j0se

Registered User.
Local time
Today, 16:15
Joined
Jan 15, 2003
Messages
57
Don't display records older than x days - problem with syntax

Hi all,

I have a table with some records:

Name, Date (Day/Month/Year)
John, 09/09/2005
Phil, 10/09/2005
Xena, 03/11/2004

I want my query to display all records with today's date, or those that are 100 days older than today's date.

I have the following so far (in my query criteria box):
Date() Or <Date()-100

BUT this shows me Xena's record, which is more than 100 days old (it's 2004)

Any help/corrections are welcome

Thanks
 
Last edited:
just >date()-100 should give you all dates upto and including 99 days ago if you want 100 days then make it >date()-101

Brian
 
nearly!

that also displays tomorrow's record - which is Phil, 10th of Nov 05

========================
Name, Date (Day/Month/Year)
John, 09/09/2005
Phil, 10/09/2005
Xena, 03/11/2004
========================

Thanks so far
 
j0se said:
Hi all,

I have a table with some records:

Name, Date (Day/Month/Year)
John, 09/09/2005
Phil, 10/09/2005
Xena, 03/11/2004

I want my query to display all records with today's date, or those that are 100 days older than today's date.

I have the following so far (in my query criteria box):
Date() Or <Date()-100

BUT this shows me Xena's record, which is more than 100 days old (it's 2004)

Any help/corrections are welcome

Thanks

Put this into a new field in the query. Replace LEAVEDATES with the fieldname
This should show you what the database thinks is in your field by calculating the difference between the dates selected and today's date.


PHP:
DATE_DIFF_FIELD: DateDiff("d",[LEAVEDATES],Date())

PS I would change your field name to something like HOLIDAYDATES - something relevant. Date is a reserved word and can cause problems if used as a field name as can spaces brackets and other forms of punctuation.

HTH

TS
 
j0se said:
that also displays tomorrow's record - which is Phil, 10th of Nov 05

========================
Name, Date (Day/Month/Year)
John, 09/09/2005
Phil, 10/09/2005
Xena, 03/11/2004
========================

Thanks so far

How about
Between Date() And Date()-100

Brian
 
thank you all

Thank you all for your help!!

Date_Diff confused me a little, so I used Between -> it does what I need

Thanks again for your time
Jose
:)
 

Users who are viewing this thread

Back
Top Bottom