Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2002
    Location
    Nottingham - UK
    Posts
    113

    Unanswered: Date Search Problem - HELP !!

    Hi peeps

    I am trying to do a date range search on a sql db - I have a field named date in a date format.

    I am using to input fields to do a date range search - the error I am getting back is below:

    [Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting datetime from character string.

    Can anyone help me pls !!

    Thanks

  2. #2
    Join Date
    Jul 2003
    Location
    Ohio/Chicago
    Posts
    75
    Hi donaldt,

    I can't say i know for sure without seeing how you are entering the date in your input, You'll need to make sure it's the same format as that in the DB since some don't use hours and seconds, some use time zone etc...

    here's some code I've used before.

    querystring = "select * " & _
    "from request_received " & _
    "where start_date < " & input1 & _
    " AND " & _
    "end_date > " & input2

    I fully recommend you hardcode into the dbms first and get the query working with constants, THEN put the variables in, it should work then without hitches if you get constants to go in.

Posting Permissions

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