Booking forms

S

Suzi

Hi

Trying to create a holidat booking database for college. having a nightmare
- anyone know how to select a range of dates - which then sets availability
to 'Not' for the inclusive dates??

Or anyone got a booking database available to use ?

Assignment due in on Thursday.....

Panic setting in fast
 
A

Albert D.Kallal

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. Howver, what is nice here is that
the simple condistion above does return ANY collsion....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top