Date search

Results 1 to 2 of 2

Thread: Date search

  1. #1
    Join Date
    Dec 1969

    Default Date search

    I have Access database with a day field. It contains the date in 5/15/00 format. I input two dates from a form to an ASP page <BR>to display the records between the two dates. They are usearch1 and usearch2 and are like 5/14 and 5/16 (no year 00&#039s) else an error of dividing by 0.<BR><BR>sql = "select * from testtable where day &#062;= &#039 & usearch1 & &#039 AND day &#060;= &#039& usearch2 & &#039 "<BR><BR>I know this is not right but I am new and cannot find the resources to fix. Please help.

  2. #2
    Vidya Guest

    Default RE: Date search

    Set rs = conn.Execute ("select * from News where cstr(dateofpost) &#062;= &#039"&cstr(Request.form("date1"))&"&#039 and cstr(dateofPost) &#060;= &#039"&cstr(Request.form("date2"))&"&#039")<BR><BR >This works perfect for me.. <BR>where dateofpost is from ACCESS database (type date())<BR>date1, date2 is of the form 5/16/00<BR><BR>The only hitch in this is that<BR>U cannot enter date1 as 05/06/00<BR>then the strings dont match since database stores May 6&#039th as<BR>5/6/00<BR><BR>But that can be solved by introducing a javascript/VBscript to ensure there are no leading zeros<BR>

Posting Permissions

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