Hi,
I'm working on a venue booking system right now for my local club which loans out its grounds and courts to people.
What I'm trying to produce is a query that will check whether a court is being booked. On this form, the user will input the start and final dates for which they wish to book this venue. I the need to check if this overlaps with any current bookings for that venue.
Problem is that I have four cases to handle, when the new booking begins before an existing, starts before the end of an existing, is "inside" the days of an existing and is "longer" that that of an existing.
So I want to make a query to return any bookings that satisfy the above, then I'll know that this new booking cannot be made.
SELECT Facility.ID, Booking.Start_Date, Booking.End_Date
FROM Booking INNER JOIN Facility_booked ON Booking.Booking_number=Facility_booked.Booking_num
WHERE (((#[Booking.Start_Date]# < #[Forms!Booking!Start_Date]#) AND (#[Booking.End_Date]# > #[Forms!Booking!End_Date]#)) OR ((#[Booking.Start_Date]# > #[Forms!Booking!Start_Date]#) AND (#[Booking.End_Date]# < #[Forms!Booking!End_Date]#)) OR ((#[Booking.Start_Date]# > #[Forms!Booking!Start_Date]#) AND (#[Booking.End_Date]# < #[Forms!Booking!End_Date]#)) OR ((#[Booking.Start_Date]# < #[Forms!Booking!Start_Date]#) AND (#[Booking.End_Date]# > #[Forms!Booking!End_Date]#)));
where Start_Date and End_Date are textboxes on my form... but now I keep getting errors.... anyone know why?
Thx.
Maldini
I'm working on a venue booking system right now for my local club which loans out its grounds and courts to people.
What I'm trying to produce is a query that will check whether a court is being booked. On this form, the user will input the start and final dates for which they wish to book this venue. I the need to check if this overlaps with any current bookings for that venue.
Problem is that I have four cases to handle, when the new booking begins before an existing, starts before the end of an existing, is "inside" the days of an existing and is "longer" that that of an existing.
So I want to make a query to return any bookings that satisfy the above, then I'll know that this new booking cannot be made.
SELECT Facility.ID, Booking.Start_Date, Booking.End_Date
FROM Booking INNER JOIN Facility_booked ON Booking.Booking_number=Facility_booked.Booking_num
WHERE (((#[Booking.Start_Date]# < #[Forms!Booking!Start_Date]#) AND (#[Booking.End_Date]# > #[Forms!Booking!End_Date]#)) OR ((#[Booking.Start_Date]# > #[Forms!Booking!Start_Date]#) AND (#[Booking.End_Date]# < #[Forms!Booking!End_Date]#)) OR ((#[Booking.Start_Date]# > #[Forms!Booking!Start_Date]#) AND (#[Booking.End_Date]# < #[Forms!Booking!End_Date]#)) OR ((#[Booking.Start_Date]# < #[Forms!Booking!Start_Date]#) AND (#[Booking.End_Date]# > #[Forms!Booking!End_Date]#)));
where Start_Date and End_Date are textboxes on my form... but now I keep getting errors.... anyone know why?
Thx.
Maldini