date query problem

Results 1 to 7 of 7

Thread: date query problem

  1. #1
    Felicity Guest

    Default date query problem

    I have the following code that should work but it doesn&#039;t. It&#039;s an MS Access 2000 database. If I select a date and time that is in the database it tells me the date is new. What am I doing wrong?<BR><BR>SQL = "SELECT * FROM tes WHERE fdate = #" &fdate& "# AND ftime = #" &ftime& "#"<BR>set oRs = conn.Execute(SQL)<BR><BR>If oRs.EOF Then<BR>response.write "date is new"<BR><BR>Else<BR>response.write "date exists"<BR><BR>End If

  2. #2
    Join Date
    Dec 1969

    Default RE: date query problem

    Depending on how your date field is setup, it may be including a time stamp... NEVER check for dates = to. Try &#062; and &#060; in order to compensate for the time.<BR><BR>8/24/2001 != 8/24/2001 9:22:10 AM

  3. #3
    Felicity Guest

    Default Okay but

    The field is set to short date like 8/24/01 and the time is from a drop down that has about 10 choices. So data in the database fields would look like <BR><BR>fdate 8/24/01<BR>ftime 6:30 AM<BR><BR>So checking for an = should work shouldn&#039;t it? I am checking to see if data for that date and time slot have been entered. So if the record is EOF it should display date is new. If it finds it it should display date exists. At least that&#039;s what I thought.

  4. #4
    Join Date
    Dec 1969

    Default RE: Okay but

    Are you sure your two variables have values in them? Do a response.write on your SQL statement to make sure.<BR><BR>Yes, you&#039;re right then, = should work.

  5. #5
    Felicity Guest

    Default EVEN WIERDER!

    The data base I am testing this with has 3 entries.<BR><BR>8/2/01 6:30 AM<BR>8/23/01 6:30 AM<BR>10/24/01 6:30 AM<BR><BR>Here&#039;s where it&#039;s gets wierd. The response.write on the sql shows a perfect query. The 8/2 and the 8/23 display date exists the 10/24 shows dat is new??? I checked the database entry for leading and trailing spaces and there are none. I don&#039;t understand this?????

  6. #6
    spell check Guest

    Default not as WEIRD as your spelling ;) {eom}


  7. #7
    Felicity Guest

    Default Must be nice

    To have nothing better to do than spell check a message board. Your field is wide open and so many many other boards to check also!

Posting Permissions

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