p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access (http://p2p.wrox.com/forumdisplay.php?f=18)
-   -   Filter form with date fields problem!! (http://p2p.wrox.com/showthread.php?t=46226)

chiefouko August 7th, 2006 07:41 AM

Filter form with date fields problem!!
 
has anybody got an idea how i could filter Access forms using date fields. Don't get me wrong... I know how to use filter but everytime i use it on date fields in Access it returns wrong dates or sometimes doesn't return anything at all.

  I have played with it soo much till now i feel am jus guessing solutions rather than know the solutions. I can't even explain why i don't get data at times and not at other times.

If you have experienced such problems please help!!.


LION OF JUDDAH!

mmcdonal August 10th, 2006 12:34 PM

Please post some data from the date fields. Access can get freaky when the dates take formats like YYYY-MM-DD, etc. SO if you date fields are not what Access is expecting, it won't return any records, or the wrong records.

One solution I use is to use a combo box to look up the dates as they are formatted, and then use them as strings to get the data filtered.

HTH

mmcdonal

SerranoG August 14th, 2006 10:15 AM

If you're talking about filtering the date fields via VBA programming just remember to delimit the date variable with pound signs. For example:

Me.Filter = "[dtmDueDate] < #" & Date() & "#"

Also remember not to name any fields in your tables just DATE because that is a reserved Access function that returns today's date.

The function Now() returns the date and current time, so only use that one if time of day matters. If not, comparing a date to Now will rarely match because a date is usually stored with midnight as the time if Now was not used in the first place.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division


All times are GMT -4. The time now is 10:39 AM.

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