Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / March 2006



Tip: Looking for answers? Try searching our database.

ADO & Access & finding dates trouble

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rick Lederman - 30 Mar 2006 02:56 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 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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.