OrthoDocSoft
Programmer
Folks,
I have a table "testsdrawn" with a column named "DateDrawn" which holds the "date and time" data type. The date "7/12/2009" is in all three records, and was written there by:
MyRecordset.Fields("DateDrawn") = Date
which works well.
Then I try to query the DB for records like this:
strSQL = "SELECT * FROM testsdrawn WHERE PatientID... blah blah " AND DateDrawn = " & Date
MyRecordSet.Open(strSQL), MyConnection, adoOpenKeyset _
adLockOptimistic
When I delete the date part, the query works fine and returns the correct PatientID, so that part is fine. When I add the lines "AND DateDrawn = " & Date," I get zero records returned (and no sql query errors).
"Date" is a function that returns today's date, and the dates in my column are all of "date and time" type, and are today's date.
Why doesn't this query find them?
Thanks,
Ortho
"you cain't fix 'stupid'...
I have a table "testsdrawn" with a column named "DateDrawn" which holds the "date and time" data type. The date "7/12/2009" is in all three records, and was written there by:
MyRecordset.Fields("DateDrawn") = Date
which works well.
Then I try to query the DB for records like this:
strSQL = "SELECT * FROM testsdrawn WHERE PatientID... blah blah " AND DateDrawn = " & Date
MyRecordSet.Open(strSQL), MyConnection, adoOpenKeyset _
adLockOptimistic
When I delete the date part, the query works fine and returns the correct PatientID, so that part is fine. When I add the lines "AND DateDrawn = " & Date," I get zero records returned (and no sql query errors).
"Date" is a function that returns today's date, and the dates in my column are all of "date and time" type, and are today's date.
Why doesn't this query find them?
Thanks,
Ortho
![[lookaround] [lookaround] [lookaround]](/data/assets/smilies/lookaround.gif)