Results 1 to 4 of 4

Thread: How to check dates

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2002
    Location
    India
    Posts
    37

    How to check dates

    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

  2. #2
    Addicted Member diban's Avatar
    Join Date
    Aug 2002
    Location
    IN
    Posts
    152
    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

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2002
    Location
    India
    Posts
    37
    Thanks Diban.
    Though I dont get any error messages, the records are not getting selected.
    Is there someother soln.
    Regards
    Kavitha

  4. #4
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918
    Try substituting the apostrophes with hashes #. Also, SQL expects dates to be passed as month/day/year.
    Give this a try:
    VB Code:
    1. Dim sql As String
    2. sql = "select * from tablename where datefield > #" &  Format$(DTpicker1.Value,"m/d/yy") & "#"
    3. recordset.open sql, db, db, adOpenStatic, adLockOptimistic

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width