Time Locks

  • Thread starter Thread starter OzPete
  • Start date Start date
O

OzPete

Hi All,

I have a very simple database that lets people book out a car on a
particular date for their exclusive use.

The car is not available to other users, by means of a simple [query] filter
based on the date. Yet I want to refine this down to allow multiple users
each day.

example:

9am - 1pm - Joe
1pm - 3pm - Tracy
3pm - 4.30pm - Dick

As is obvious from the second sentence, I can exclude by date, it's crude
albeit it works. I want to exclude by time, so:

if Tracy wants the car from 12.15pm to 3pm, she can't have it, cos Joe has
it till 1pm, but she CAN book it from 1pm onwards.... what's the easiest
way guys and gals?

tia

OzPete
 
I would have a table along the following lines:

tblBooking
CarID
From (date/time)
To (date/time)

Then, when someone wants to book car #99 from 1/1/2004 9am to 2/2/2004 5pm,
you search thattable for any existing booking which overlaps the desired
booking period. If you find one or more such records, the new person cannot
book that car for that whole period.

HTH,
TC
 
That's right in theory. But in practice, its quite difficult to write code
that checks for those time conflicts. But I found just such code on Allen
Browne's web site a few days ago. Check it out at
http://members.iinet.net.au/~allenbrowne/appevent.html
--
John Loewen
Loewen Computing Services


TC said:
I would have a table along the following lines:

tblBooking
CarID
From (date/time)
To (date/time)

Then, when someone wants to book car #99 from 1/1/2004 9am to 2/2/2004 5pm,
you search thattable for any existing booking which overlaps the desired
booking period. If you find one or more such records, the new person cannot
book that car for that whole period.

HTH,
TC


OzPete said:
Hi All,

I have a very simple database that lets people book out a car on a
particular date for their exclusive use.

The car is not available to other users, by means of a simple [query] filter
based on the date. Yet I want to refine this down to allow multiple users
each day.

example:

9am - 1pm - Joe
1pm - 3pm - Tracy
3pm - 4.30pm - Dick

As is obvious from the second sentence, I can exclude by date, it's crude
albeit it works. I want to exclude by time, so:

if Tracy wants the car from 12.15pm to 3pm, she can't have it, cos Joe has
it till 1pm, but she CAN book it from 1pm onwards.... what's the easiest
way guys and gals?

tia

OzPete
 
Say someone wants to book car #99 from 1/1/2004 to 2/2/2004. (I've chosen
those weird dates so there is no confusion about dmy vs. mdy).

Here is the code:

if dlookup (true, "tblBooking", "CarID=99 AND From>=#1/1/2004# AND
To<=#2/2/2004#) then
msgbox "sorry, car 99 is not available for some or all of that time!"
endif

Adding the time (hours) component would be no more difficult.

Doesn't look too difficult! :-)

TC


JohnWL said:
That's right in theory. But in practice, its quite difficult to write code
that checks for those time conflicts. But I found just such code on Allen
Browne's web site a few days ago. Check it out at
http://members.iinet.net.au/~allenbrowne/appevent.html
--
John Loewen
Loewen Computing Services


TC said:
I would have a table along the following lines:

tblBooking
CarID
From (date/time)
To (date/time)

Then, when someone wants to book car #99 from 1/1/2004 9am to 2/2/2004 5pm,
you search thattable for any existing booking which overlaps the desired
booking period. If you find one or more such records, the new person cannot
book that car for that whole period.

HTH,
TC


OzPete said:
Hi All,

I have a very simple database that lets people book out a car on a
particular date for their exclusive use.

The car is not available to other users, by means of a simple [query] filter
based on the date. Yet I want to refine this down to allow multiple users
each day.

example:

9am - 1pm - Joe
1pm - 3pm - Tracy
3pm - 4.30pm - Dick

As is obvious from the second sentence, I can exclude by date, it's crude
albeit it works. I want to exclude by time, so:

if Tracy wants the car from 12.15pm to 3pm, she can't have it, cos Joe has
it till 1pm, but she CAN book it from 1pm onwards.... what's the easiest
way guys and gals?

tia

OzPete
 
John and TC,

Basically I wanted what John aspires to in his fantastic link.

John you are beautiful, disregard what other people say, you are....

TC, your idea in theory is what i have now, I wanted to refine it down as
John's web link does... but mate, you are beautiful too!

cheers from the sunburnt country

OzPete
 
Back
Top