I have an Access database with a LOG table that has a DATE_TIME field that
is a Date/Time data type. When I look in the database with Access there are
a bunch of records with the value 11/8/2005 11:28:15 AM in the DATE_TIME
field. However, when I use ADO to .Find a record with that value like:
rsDestination.Find ("DATE_TIME = #" & dtTemp & "#")
where dtTemp = 11/8/2005 11:28:15 AM , the recordset returns a .eof, finding
none of the records. But there are plenty of them there as my code has been
adding them since it thinks none are there. Interestingly, within Access
itself if I open the table, point into the column DATE_TIME and do a Find
with Access, it finds them HOWEVER if I uncheck the "Search Fields as
FOrmatted" box, then it does NOT find any.
A query such as SELECT LOG.DATE_TIME FROM LOG WHERE
(((LOG.DATE_TIME)=#11/8/2005 11:28:15#)); also finds NO RECORDS, even though
I can see them.
Any ideas what is wrong with the database? Or my SQL statement? Or my Find
statement?

Signature
Rick Lederman
Soaring Software Solutions, Inc.
www.soaringsoftware.com
rick@soaringsoftware.com
Richard Mueller - 30 Mar 2006 06:17 GMT
>I have an Access database with a LOG table that has a DATE_TIME field that
>is a Date/Time data type. When I look in the database with Access there
[quoted text clipped - 15 lines]
> Any ideas what is wrong with the database? Or my SQL statement? Or my
> Find statement?
Hi,
I don't have problems using your syntax for an ADO query on date/time fields
in Access tables. However, there could be precisions problems. See this kb
article:
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q130514
Does it help to try:
SELECT Log.Date_Time FROM Log WHERE Log.Date_Time > #11/8/2005 11:28:14# AND
Log.Date_Time < #11/8/2005 11:28:16#

Signature
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
Clinton - 30 Mar 2006 09:22 GMT
11/8/2005: Is that 11 August or 8 November?
To start with, always use this format with date fields (regardless of the
Displayed date format!):
yyyy-mm-dd
Format$(TheDate,"yyyy-mm-dd")
This will always exclude errors caused by different date formats and the
user international settings and is recognized by most all DBMSs.
Clinton - 30 Mar 2006 09:24 GMT
Forgot, you are using Date and time:
Format as:
"yyyy-mm-dd hh:nn:ss"
and make sure the hour is in 24 hour format