Find records more then 30 days old?

  • Thread starter Thread starter SRussell
  • Start date Start date
S

SRussell

This is an access97 environment if it matters. I am looking for all rows
that are older then 30 in the [Date Checked In] column.

This is from my where clause:

and datediff( "d" , [Date Checked In] , dateadd( "y", -30, date() )) > 30

or tried

and datediff( "d" , [Date Checked In] , date() ) > 30

neither worked? Where am I going wrong?

TIA

__Stephen
 
SRussell said:
This is an access97 environment if it matters. I am looking for all
rows that are older then 30 in the [Date Checked In] column.

This is from my where clause:

and datediff( "d" , [Date Checked In] , dateadd( "y", -30, date() ))

or tried

and datediff( "d" , [Date Checked In] , date() ) > 30

neither worked? Where am I going wrong?

TIA

__Stephen

The second one looks fine. What happens? Do you get no records, too many
records, or too few records?
 
Rick Brandt said:
SRussell said:
This is an access97 environment if it matters. I am looking for all
rows that are older then 30 in the [Date Checked In] column.

This is from my where clause:

and datediff( "d" , [Date Checked In] , dateadd( "y", -30, date() ))

or tried

and datediff( "d" , [Date Checked In] , date() ) > 30

neither worked? Where am I going wrong?

TIA

__Stephen

The second one looks fine. What happens? Do you get no records, too many
records, or too few records?

It wouldn't save / compile. It gave an error that something was wrong.
This was done at clients site. It works on my machine, but I have 2003
version???
 
I would use

Where [Date Checked In] < Date() - 30

That is going to more efficient than calculating the datediff on every
record.

Where [Date Checked in] < DateAdd("d",-30,Date())

Should also work.
 
Back
Top