DWUTKA at marlow.com
DWUTKA at marlow.com
Mon Oct 23 16:26:06 CDT 2006
Why not just use DateValue? Drew -----Original Message----- From: Heenan, Lambert [mailto:Lambert.Heenan at aig.com] Sent: Monday, October 23, 2006 11:06 AM To: 'Access-D Email (accessd at databaseadvisors.com)'; 'ACCESS-L Email (ACCESS-L at PEACH.EASE.LSOFT.COM)' Subject: [AccessD] Tip concerning dates in Access Often you'll have a date field in a table that has the date and time stored in it, but you may want to run a query that simply shows the date, without the time. Up to now I have been using Clng() to strip off the time part in a query like this: A Date: Cdate(Clng(dSomeDate)) but I just realized the lurking bug in this. CLng rounds up or down, depending on which side of noon the time part is. So 1/1/2006 08:30:00 AM would display as 1/1/2006, but 1/1/2006 12:30:00 PM would be 1/2/2006. To avoid this problem use Fix() instead of Clng()... A Date: Cdate(Fix(dSomeDate)) Fix always returns just the 'integer' part of the number passed to it. The documentation suggests that Fix only returns an integer, but in fact it is capable or returning Longs too, which is what date values are equivalent to. HTH Lambert