filter date

C

Cynthia

I am trying to add a filter to my form via the user. Rick Brandt helped me
yesterday and I added the # and thought it was working. Further testing
shows it is not working.

gstrfiltertext = ([qryCircuit].[RouteRelDate]> #8/15/2006#)
then I add the statement me.filter = gstrfiltertext. It is filtering out
some dates, but not what it should?

RouteRelDate is a field in my sql table that is a date field and is linked
to access.

I am stuck and could really use some help on this.

Thank you
Cynthia
 
D

Douglas J. Steele

Using dates in text fields causes lots of problems. Due to how text sorts,
10/1/2006 will NOT be greater than 8/15/2006, despite the fact that October
1st occurs after August 15th.

If you cannot get the data field corrected in the source, try using the date
conversion function:

gstrfiltertext = "CDate([qryCircuit].[RouteRelDate]) > #8/15/2006#"


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Cynthia said:
Sorry, the routereldate field is a text field not a date field.

Cynthia said:
I am trying to add a filter to my form via the user. Rick Brandt helped
me
yesterday and I added the # and thought it was working. Further testing
shows it is not working.

gstrfiltertext = ([qryCircuit].[RouteRelDate]> #8/15/2006#)
then I add the statement me.filter = gstrfiltertext. It is filtering out
some dates, but not what it should?

RouteRelDate is a field in my sql table that is a date field and is
linked
to access.

I am stuck and could really use some help on this.

Thank you
Cynthia
 
Top