Results 1 to 3 of 3

Thread: msflexgrids and dates

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Posts
    15

    Thumbs down

    Help!

    I was just wodering if anyone knows how to create an SQL string for a database where it would select from a table a range of dates. This code errors out to do with the dates.

    Dim db As Database
    Set db = OpenDatabase(App.Path & "\adpdumb.mdb")
    Set Data1.Recordset = db.OpenRecordset("SELECT date,time,appointment From schedule where date between 'November 3, 2000' and 'November 6, 2000';")

    Thanks,

    aknighter

  2. #2
    Hyperactive Member
    Join Date
    Feb 2000
    Posts
    284
    You might need to wrap the dates in # instead of ' and also you need to see what format your database expects the date. I am not sure if between works, if it doesn't you could always use > <.

    Hope this helps

  3. #3
    New Member
    Join Date
    Nov 2000
    Location
    Dublin, Ireland
    Posts
    10
    Originally posted by aknighter
    Help!

    I was just wodering if anyone knows how to create an SQL string for a database where it would select from a table a range of dates. This code errors out to do with the dates.

    Dim db As Database
    Set db = OpenDatabase(App.Path & "\adpdumb.mdb")
    Set Data1.Recordset = db.OpenRecordset("SELECT date,time,appointment From schedule where date between 'November 3, 2000' and 'November 6, 2000';")
    Set Data1.Recordset = db.OpenRecordset("SELECT date,time,appointment From schedule where
    date between #" & Format("November 3, 2000","MM/dd/yyyy")& "# and #" & Format("November 6, 2000","MM/dd/yyyy") & "#"

    s.e.a

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