J
Jake
Hi, I originally posted in the db group but thought this might be more
appropriate here.
I have a scheduling application which allows the user to reserve timeslots
for various things but I'm having trouble figuring out how to detect if a
reservation being added is conflicting with an existing reservation.
Basically its a logic problem.
I am currently able to detect timeslots that overlap start and/or end times
but cant figure out how to detect other conflicts.
For example, here's my check routine:
schedcheck = "Select * FROM Schedule WHERE ItemIndex = "&strItemIndex&" AND
Sched_Date = #"& strSched_Date &"# AND (Sched_Start BETWEEN # "&
strSched_Start &" # AND # "& dateAdd("n",-1,strSched_End) &" # OR Sched_End
BETWEEN # "& dateAdd("n",1,strSched_Start) &"# AND # "& strSched_End &"#) "
This detects conflicts such as a new reservation being scheduled from 1:00
pm to 4:00 pm and there's already an existing reservation from 2:00 pm to
5:00 pm. Since there is an overlap of times, it catches it, but what I'm
missing is if I have, say an existing reservation from 1:00 pm to 5:00 pm
and someone tries to schedule one from 2:00 pm to 4:00 pm. Since the new
reservation times don't overlap the existing start or end times, and are
actually in between the existing start and end times, it doesn't get caught.
How can I adjust or re-do my statement to catch every possible conflict?
Any help or suggestion greatly appreciated!
appropriate here.
I have a scheduling application which allows the user to reserve timeslots
for various things but I'm having trouble figuring out how to detect if a
reservation being added is conflicting with an existing reservation.
Basically its a logic problem.
I am currently able to detect timeslots that overlap start and/or end times
but cant figure out how to detect other conflicts.
For example, here's my check routine:
schedcheck = "Select * FROM Schedule WHERE ItemIndex = "&strItemIndex&" AND
Sched_Date = #"& strSched_Date &"# AND (Sched_Start BETWEEN # "&
strSched_Start &" # AND # "& dateAdd("n",-1,strSched_End) &" # OR Sched_End
BETWEEN # "& dateAdd("n",1,strSched_Start) &"# AND # "& strSched_End &"#) "
This detects conflicts such as a new reservation being scheduled from 1:00
pm to 4:00 pm and there's already an existing reservation from 2:00 pm to
5:00 pm. Since there is an overlap of times, it catches it, but what I'm
missing is if I have, say an existing reservation from 1:00 pm to 5:00 pm
and someone tries to schedule one from 2:00 pm to 4:00 pm. Since the new
reservation times don't overlap the existing start or end times, and are
actually in between the existing start and end times, it doesn't get caught.
How can I adjust or re-do my statement to catch every possible conflict?
Any help or suggestion greatly appreciated!