Results 1 to 5 of 5
  1. #1
    masterdaave is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    3

    Hotel Availability

    I am working on a Hotel booking system project.



    For simplicity I have two tables:

    tblBooking: bookingID, roomNum*, checkIn, checkOut
    tblRooms: roomNum, roomType, cost

    I want to search the booking table with a check in and check out date and return all the rooms that are available.

    I have tried querying and creating some outer join solutions but I am terrible with joins/unions and cannot get near a solution although I feel it shouldn't be too hard.

    I appreciate any help people can offer.

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Thee is a free data model here that may meet some of your needs, or give you some ideas.

  3. #3
    masterdaave is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    3
    Quote Originally Posted by orange View Post
    Thee is a free data model here that may meet some of your needs, or give you some ideas.
    Hi,

    sorry but that doesn't really help. I have already set up my data model. What I am struggling to do is check availability of a room.
    EXAMPLE
    I need a list of rooms that are available at this date. If the booking table has the following data:

    bookID, rmNum, checkIn, checkOut
    1..........1..........26/1..........27/1
    2..........1..........29/1..........1/2
    3..........1..........5/2............6/2
    4..........2..........24/1..........26/1

    and the room table has the following data
    RmNum, Type
    1............Double
    2............Double
    3............Single

    Searching for a room between the dates of 28/1 and 30/1 should return rooms 2 and 3.

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Show readers:
    - a jpg of your data model
    - your business rules


    Which numbers represent Rooms/Records?

    See if this helps
    Last edited by orange; 01-27-2015 at 05:39 PM.

  5. #5
    masterdaave is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    3
    I actually managed it with the following queries:

    qryAllRooms
    SELECT *
    FROM bookings;

    qryAvailableBookings
    SELECT booking.ID, booking.start, booking.end, booking.roomNum
    FROM booking
    WHERE (((booking.start)<#1/4/2013# And (booking.start)<#1/6/2013#) AND ((booking.end)<#1/4/2013# And (booking.end)<#1/6/2013#)) OR (((booking.start)>#1/4/2013# And (booking.start)>#1/6/2013#) AND ((booking.end)>#1/4/2013# And (booking.end)>#1/6/2013#));



    qryNotAvailable
    SELECT *
    FROM qryAllRooms
    WHERE ID NOT IN (SELECT ID FROM qryAvailableBookings);


    qryAvailable
    SELECT *
    FROM rooms
    WHERE roomNum NOT IN (SELECT roomNum FROM qryNotAvailable)

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 06-06-2014, 02:04 PM
  2. Availability Calendar in access
    By tommy93 in forum Access
    Replies: 16
    Last Post: 11-14-2013, 05:38 PM
  3. Hotel database
    By femiores in forum Database Design
    Replies: 1
    Last Post: 03-24-2012, 01:13 PM
  4. Item Availability help
    By Sawyer05 in forum Database Design
    Replies: 1
    Last Post: 02-18-2012, 11:03 AM
  5. hotel reservation, please help
    By forgotten in forum Database Design
    Replies: 1
    Last Post: 08-12-2009, 10:30 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums