Well, I can certainly give you some good tips here:
First, use a date+time field for your booking table.
Further, using a startDate+Time field,
and
use a EndDate+Time field.
So, have a field for the start of the booking, and the end time of the
booking The fact that you only have 30-120 minutes here is really moot. With
a start and end time, you can have any amount of time you wish. You can
certainly restrict the booking times to 30 minute increments, but that is
only a choice that you RESTRICT the user to, not some HARD coded part of
your design.
The beauty of the above is that you can use the VERY simply formula to find
a booking collision.
So, the trick in a booking system is to only store the start and end date of
the
booking.
And, to prevent collisions, the logic here is quite simple:
A collision occurs when:
RequestStartDate <= EndDate
and
RequestEndDate >= StartDate
The above is thus a rather simply query, but if any collision occurs, the
above will return records..and you simply don't allow the booking. In other
words, since we NEVER allow booking with a collision, then the above simply
statement will work for us.
dim strWhere as string
dim dtRequeestStartDate as date
dim dtRequestEndDate as date
dtRequestStartDate = inputbox("Enter start Date")
dtRequestEndDate = inputbox("Enter end date")
strWhere="#" & format(dtRequestStartDate,"mm/dd/yyyy") & "# <= EndDate" & _
" and #" & format(dtRequestEndDate,"mm/dd/yyyy") & "# >= StartDate"
if dcount("*","tableBooking",strWhere) > 0 then
msgbox "sorry, you can't book
....bla bla bla....
The above is just an example, and I am sure you would build a nice form that
prompts the user for the booking dates. However, what is nice here is that
the simple conditions above does return ANY collision. Your form will
simply ask for the time, but you also must specify a date. If you make
the above conditions include the date+time, then the above will
still work for your needs...