Check Vacancy position based on given date

  • Thread starter shganduri via AccessMonster.com
  • Start date
S

shganduri via AccessMonster.com

There are say about 20 rooms in a Resort and each room is given a different
number. When a set of two dates are given i.e. start date and end date, I
want the programme to check for vacancy position of rooms for the given dates.
I mean it should show me that the following rooms are not used or vacancy
during the dates you have mentioned.

Can somebody help me in writing a code or creation of some way to achieve
what I want to.
 
A

Allen Browne

Use a subquery to identify the rooms that don't have any date booked in that
range.

Here's an introduction to subqueries:
http://allenbrowne.com/subquery-01.html#NotThere
The first example should help: Identiying what's NOT there.

It will end up looking something like this:

SELECT RoomID FROM tblRoom
WHERE NOT EXISTS
(SELECT RoomID FROM tblBooking
WHERE tblBooking.RoomID = tblRoom.RoomID
AND tblBooking.BookingDate Between [start date] And [end date]);
 
S

shganduri via AccessMonster.com

Mr Browne,

Thank you for your very prompt response. I will work your suggestion at the
earliest and get back to you immediately thereafter.



Allen said:
Use a subquery to identify the rooms that don't have any date booked in that
range.

Here's an introduction to subqueries:
http://allenbrowne.com/subquery-01.html#NotThere
The first example should help: Identiying what's NOT there.

It will end up looking something like this:

SELECT RoomID FROM tblRoom
WHERE NOT EXISTS
(SELECT RoomID FROM tblBooking
WHERE tblBooking.RoomID = tblRoom.RoomID
AND tblBooking.BookingDate Between [start date] And [end date]);
There are say about 20 rooms in a Resort and each room is given a
different number. When a set of two dates are given i.e. start date and
[quoted text clipped - 4 lines]
Can somebody help me in writing a code or creation of some way to
achievewhat I want to.
 

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