Find()ing Date/Time fields 
Author Message
 Find()ing Date/Time fields

I'm afraid that SQL is a big problem in this office--it is always a
shot in the dark for us. I'm trying to search for records on a specific
day. The SQL string that gets sent to the Find() methods is:

sQuery.Format("([LoginTime] >= DateValue('%s 12:00:01 AM')) AND
([LoginTime] <= DateValue('%s 11:59:59 PM'))",
    date.Format("%d/%m/%y"), date.Format("%d/%m/%y"))

Oddly enough, I need *both* equal signs in there, and if I omit the
times (and just specify dates) it won't pick up anything.

So what is the proper SQL query that will find me a record with a
certain field having a certain date, at any time of the day?

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Sun, 23 Feb 2003 02:38:03 GMT  
 Find()ing Date/Time fields


Fri, 19 Jun 1992 00:00:00 GMT  
 Find()ing Date/Time fields
Which database are you working with?  I use SQL Server and it has a nice
little tool, Query Analyzer, that I use to test SQL queries.  It's
wonderful!

With SQL Server, you don't need to specify the time (or put a variant
into the query).  You simply do "SELECT xxx FROM yyy WHERE [LoginTime]
<= '1990-01-01'" and this works.

I think things might be different with Access but I can't comment on it
since I just have a modicum of experience with it.

/Martin

Quote:
-----Original Message-----

Posted At: Tuesday, September 05, 2000 2:38 PM
Posted To: database
Conversation: Find()ing Date/Time fields
Subject: Find()ing Date/Time fields

I'm afraid that SQL is a big problem in this office--it is always a
shot in the dark for us. I'm trying to search for records on a specific
day. The SQL string that gets sent to the Find() methods is:

sQuery.Format("([LoginTime] >= DateValue('%s 12:00:01 AM')) AND
([LoginTime] <= DateValue('%s 11:59:59 PM'))",
    date.Format("%d/%m/%y"), date.Format("%d/%m/%y"))

Oddly enough, I need *both* equal signs in there, and if I omit the
times (and just specify dates) it won't pick up anything.

So what is the proper SQL query that will find me a record with a
certain field having a certain date, at any time of the day?

Sent via Deja.com http://www.deja.com/
Before you buy.



Mon, 24 Feb 2003 04:09:34 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Change date field type from long to Date/Time

2. Can't read time from Access 2000 date/time field

3. Date and time fields

4. Date/Time field in Access db

5. Update Access 2000 Date/Time field error

6. Useing dbbind with Date/Time Fields

7. Memory access violation using CRecordset and date/time fields

8. Date/Time Fields in ODBC

9. C time/date to Visual Basic time/date

10. Date Time Picker - Date AND Time

11. needed: C fn to find date/time of file

12. Finding date/time

 

 
Powered by phpBB® Forum Software