Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Jan 2001
    Location
    Indiana
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Time frame query (Access 2000 SR1a)

    Is there a way to have a start time and end time field. But create a query that will see if a time is used or not. Example, if Room A is booked from 1 to 3 and user requests the room at 2 it will let them know Room A is booked. Or do i have to create a record for every increment a room is booked to check if it is available.

    Thanks
    Tom

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Time frame query (Access 2000 SR1a)

    You could build a query that looks for rooms where the booking start time is less than the requested time, and the booking finish time is greater than the requested time. Any rooms returned will be booked at the requested time.
    Regards
    John



  3. #3
    Lounger
    Join Date
    Jan 2001
    Location
    Indiana
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Time frame query (Access 2000 SR1a)

    John,

    I tried your suggestion and didn't get the results expected. However, I started experimenting a little bit and found that if I make the requested start time >= the current start time and the requested end time <= the current booked finish time I did get the desired results. The query now returns rooms already booked during that time frame.

    Thank you for helping me over this stumbling block.
    It really got the creative juices flowing.

    Tom

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Time frame query (Access 2000 SR1a)

    You can also use the Between [Date1] And [Date2] syntax for the same purpose. That includes both the beginning and ending values in the returned records. However, if you are using general dates (i.e., dates entered using the Now() function), you need to be careful because a date entered without the time specified won't match the dates you expect. In that case, you have to specify less than the next day as the second criteria in order to include all date/times up to midnight.
    Charlotte

Posting Permissions

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