PDA

Click to See Complete Forum and Search --> : How to check dates


kavimegam
Dec 3rd, 2002, 08:48 AM
I created a field of type Date/Time using Visual Data Manager
I am not able to use select statement with where clause like this,

recordset.open "select * from tablename where datefield>'" & DTpicker1.value & "'",db, db, adOpenStatic, adLockOptimistic

how do I check date/time values in a table using the DTpicker controls in a form

I want to select orders make between given two dates

Warm Ragards
Kavitha

diban
Dec 3rd, 2002, 02:22 PM
Hi

Try

recordset.open "select * from tablename where datefield >" & DTpicker1.value, db, db, adOpenStatic, adLockOptimistic

You passed string to date earlier, just remove the " ' " from ur statement

kavimegam
Dec 3rd, 2002, 09:28 PM
Thanks Diban.
Though I dont get any error messages, the records are not getting selected.
Is there someother soln.
Regards
Kavitha

pnish
Dec 4th, 2002, 11:31 PM
Try substituting the apostrophes with hashes #. Also, SQL expects dates to be passed as month/day/year.
Give this a try:Dim sql As String
sql = "select * from tablename where datefield > #" & Format$(DTpicker1.Value,"m/d/yy") & "#"
recordset.open sql, db, db, adOpenStatic, adLockOptimistic