Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ADO FIlter by Date with MS Access

43 views
Skip to first unread message

Rick Lipkin

unread,
May 24, 2012, 2:13:17 PM5/24/12
to
To All

I have a Ms Access recordset with a datetime field called [Repair drop date]. I am trying to create a filter condition to be able to find all rows that are over 30 days old.

I have tried various incantations like :

oRs:FIlter := "[Repair Drop Date]+30 <= date()" which fails .. however if you use it in a "Select * from Repair where [Repair Drop Date]+30 <= date()" it WORKS ..

The filter condition shows a character mismatch in the error log. I have also used this syntax

oRs:Filter := "[Repair Drop Date] between #01/01/2012# and "05/24/2012#" which also fails.

Any Idea how I can create a FILTER condition on an existing recordset to compare dates?

Thanks
Rick Lipkin

ella....@xharbour.com

unread,
May 24, 2012, 3:34:39 PM5/24/12
to
Hello,

Have you tried the standard way ("between" is an exotic SQL extension)? I mean:

[myfield]>=#01/01/2012# and [myfield]<=#05/24/2012#

Ella

dlzc

unread,
May 24, 2012, 3:37:49 PM5/24/12
to
Dear Rick Lipkin:

On Thursday, May 24, 2012 11:13:17 AM UTC-7, Rick Lipkin wrote:
...
> I have tried various incantations like :
>
> oRs:FIlter := "[Repair Drop Date]+30 <= date()"
> which fails ..

How about assuming the "back end coders" were not much smarter than me? Try:
oRs:FIlter := "[Repair Drop Date] <= date()-30"
... or ...
oRs:FIlter := "[Repair Drop Date] <= (date()-30)"

David A. Smith
0 new messages