Thread: Forward booking
View Single Post
  #2 (permalink)  
Old June 16th, 2004, 06:02 PM
tnd tnd is offline
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Assuming your table stores the start and end dates in 2 seperate columns then you simply need to make sign of the difference in dates for any row is the same.
Ie
row Start End
1 1/14 1/16
2 1/21 1/25

New request 1/15 - 1/17
So you run datediff (or whatever function in access/excel)
1/14 and 1/15 = 1
1/16 and 1/15 = -1 the signs are different so 1/15 is between 1/14 and 1/16

request 1/18 - 1/19
1/14 and 1/18 = 4
1/16 and 1/18 = 2 then signs are same so 1/18 is outside of 1/14 and 1/16
1/14 and 1/19 = 5
1/16 and 1/19 = 3

As long as the sign is the same any start/end pair then the date you are checking is not in the range.
Do the same for all the previous bookings and you're all set.

Reply With Quote