Results 1 to 3 of 3

Thread: Comparing times and dates...

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2000
    Posts
    323
    I am building a calendar and have ideas that I don't know how to build. I have the basic functionality pulling from a database and so on to make the calendar work. What I want to do is make the home page automatically pull up the next 4 hours of schedules and display them on the page. I'm sure there is something that compares Now to the database, but I don't know how to do it. Please assist with that if you can. Thanks.

    If you think education is expensive, try ignorance.

  2. #2
    Guest
    You could do something like this:

    Dim dteStart
    Dim dteEnd

    dteStart = Now()
    dteEnd = DateAdd("h", 4, dteStart)

    To get your starting and ending dates/times and then use some SQL on your database that looked like this:

    ' SQL Server:
    Set rstSchedule = conYourConnection.Execute("SELECT * FROM YourScheduleTable WHERE YourScheduleTablesDateField BETWEEN '" & dteStart & "' AND '" & dteEnd & "'")

    ' Access (97):
    Set rstSchedule = conYourConnection.Execute("SELECT * FROM YourScheduleTable WHERE YourScheduleTablesDateField BETWEEN #" & dteStart & "# AND #" & dteEnd & "#")

    Good luck,
    Paul

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2000
    Posts
    323
    That's exactly what I was looking for. Thanks
    If you think education is expensive, try ignorance.

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