comparing dates from an access dbase

Results 1 to 2 of 2

Thread: comparing dates from an access dbase

  1. #1
    Steb Guest

    Default comparing dates from an access dbase

    hi,<BR><BR>i&#039;m using an access database, trying to use this SQL query :<BR><BR>cmdDC.CommandText = "SELECT * FROM tones WHERE date BETWEEN &#039;" & dfind & "&#039; AND &#039;" & date & "&#039;;"<BR><BR>basically, to find the rows with the date field between the one endtered by the user and today. It doesn&#039;t seem to work correctly, as only the day part of the date entered is compared.<BR><BR>can anyone help, or give a solution?<BR><BR>thanks!<BR>

  2. #2
    Join Date
    Dec 1969

    Default Use # for dates in access

    Also, date is a reserved word in SQL so you have to enclose it in [] (or change the name, preferably). You can use the date function in Jet-sql as well.<BR><BR>cmdDC.CommandText = "SELECT * FROM tones WHERE [date] BETWEEN #" & dfind & "# AND date"<BR><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