A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Is there a query for this



 
 
Thread Tools Display Modes
  #1  
Old November 25th, 2008, 11:15 AM posted to microsoft.public.access.tablesdbdesign
H. Druss
external usenet poster
 
Posts: 11
Default Is there a query for this

Hi All
Front end vb6, back end Access.
Program makes reservations for my library.
4 rooms, length of reservation will be in half hour increments
I need to be sure two events are not booked with overlapping times.
Right now I retrieve a recordset as follows

Date, Room, StartTime, StopTime ( sorted by StartTime)
So a typical recorset with two events scheduled might look like:

12/5/2008 Druker Auditorium 9:00am 10:30am
12/5/2008 Druker Auditorium 1:30pm 4:00pm

Would there be any type of query to be sure another reservation would not
confilct.
e.g. A person would try to book an event from 3:00pm until 6:00pm


Thank you
Harold


  #2  
Old November 25th, 2008, 12:07 PM posted to microsoft.public.access.tablesdbdesign
Allen Browne
external usenet poster
 
Posts: 11,706
Default Is there a query for this

The logic is that 2 events clash if:
A starts before B ends, AND
B starts before A ends.

You can see this meets all cases if you diagram it on a piece of paper,
e.g.:
A ------------------------------
B ------------------
or:
A ----------------------------------
B --------
and so on.

Use record-level validation (the Form_BeforeUpdate event if you were working
in Access) to see if there is any other record for which this condition is
met

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"H. Druss" wrote in message
...
Hi All
Front end vb6, back end Access.
Program makes reservations for my library.
4 rooms, length of reservation will be in half hour increments
I need to be sure two events are not booked with overlapping times.
Right now I retrieve a recordset as follows

Date, Room, StartTime, StopTime ( sorted by StartTime)
So a typical recorset with two events scheduled might look like:

12/5/2008 Druker Auditorium 9:00am 10:30am
12/5/2008 Druker Auditorium 1:30pm 4:00pm

Would there be any type of query to be sure another reservation would not
confilct.
e.g. A person would try to book an event from 3:00pm until 6:00pm


  #3  
Old November 27th, 2008, 10:11 AM posted to microsoft.public.access.tablesdbdesign
H. Druss
external usenet poster
 
Posts: 11
Default Is there a query for this

Hi Allen
Perfect! I've applied the logic to a vb Function.
Thank you very much.
Harold

"Allen Browne" wrote in message
...
The logic is that 2 events clash if:
A starts before B ends, AND
B starts before A ends.

You can see this meets all cases if you diagram it on a piece of paper,
e.g.:
A ------------------------------
B ------------------
or:
A ----------------------------------
B --------
and so on.

Use record-level validation (the Form_BeforeUpdate event if you were
working in Access) to see if there is any other record for which this
condition is met

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"H. Druss" wrote in message
...
Hi All
Front end vb6, back end Access.
Program makes reservations for my library.
4 rooms, length of reservation will be in half hour increments
I need to be sure two events are not booked with overlapping times.
Right now I retrieve a recordset as follows

Date, Room, StartTime, StopTime ( sorted by StartTime)
So a typical recorset with two events scheduled might look like:

12/5/2008 Druker Auditorium 9:00am 10:30am
12/5/2008 Druker Auditorium 1:30pm 4:00pm

Would there be any type of query to be sure another reservation would not
confilct.
e.g. A person would try to book an event from 3:00pm until 6:00pm




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:47 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.