RandomGuy123
Registered User.
- Local time
- Today, 00:41
- Joined
- Feb 12, 2014
- Messages
- 15
Hello everyone,
I'm having some significant difficulties with a simplistic database I have designed for a hotel scenario. I want my database to automatically prevent double bookings from occurring (and also inform the user that the double booking has been prevented) and due to my lack of expertise/knowledge of VBA and database, I'm struggling - this is for a client of mine.
The Database consists of four tables:
CUSTOMERS (Customer ID, Title, Forename, Surname, Date of Birth, Gender, Address Line 1, Address Line 2, Town, County, Postcode, Telephone Number, E-Mail Address)
EMPLOYEES (Employee ID, Title, Forename, Surname, Date of Birth, Gender, Address Line 1, Address Line 2, Town, County, Postcode, Telephone Number, E-Mail Address, Job Title)
ROOMS (Room ID, Room Type, Room Rate)
BOOKINGS (Booking ID, Customer ID, Room ID, Employee ID, Booking Start Date, Booking End Date, Wake-Up Call, Airport Transportation, Car Rental, Laundry & Dry Cleaning, Newspapers & Magazines, Flowers)
All four of these tables also have forms.
The following fields in the Bookings table are check boxes:
Wake-Up Call, Airport Transportation, Car Rental, Laundry & Dry Cleaning, Newspapers & Magazines, Flowers
The following is what I want to happen with the Bookings form:
I want the employee to select the Customer ID for the customer who is making the booking, the Room ID (the room which the customer will stay in - the hotel has 24 rooms and therefore in the Rooms table there are 24 Records/Primary Keys), the Employee ID (the employee who is making the booking) and the Booking Start Date and Booking End Date.
When I click the 'Save Booking Details' button which is on the Bookings form, I want the system to check whether another booking for the same room lies within the Booking Start Date and the Booking End Date.
The following is an example:
I have made a booking which starts on the 25/12/2014 and ends on 31/12/2014 for room number 6. If I try to make another booking for room number 6 for the start date of 20/12/2014 and the end date of 27/12/2014 or the start date of 23/12/2014 and the end date of 03/01/2015, the double booking should automatically be prevented as it falls in the time frame for when room number 6 has already been booked.
Simply, when I click the 'Save Booking Details' button, it should check whether the booking requested is possible; if it is possible then the booking should be saved as a record in the Bookings table and a message should appear confirming the booking. If not, a message should inform the user that the room is already booked for that time-frame/a double booking was attempted.
I think the solution lies with a VB Code which would be put as the Event Procedure of the button however I kindly request that you provide it. I have looked significantly on the Internet for a solution and haven't found one and I sincerely request your help. Please do not hesitate to request any images of the database.
Kind Regards,
RandomGuy123
I'm having some significant difficulties with a simplistic database I have designed for a hotel scenario. I want my database to automatically prevent double bookings from occurring (and also inform the user that the double booking has been prevented) and due to my lack of expertise/knowledge of VBA and database, I'm struggling - this is for a client of mine.
The Database consists of four tables:
CUSTOMERS (Customer ID, Title, Forename, Surname, Date of Birth, Gender, Address Line 1, Address Line 2, Town, County, Postcode, Telephone Number, E-Mail Address)
EMPLOYEES (Employee ID, Title, Forename, Surname, Date of Birth, Gender, Address Line 1, Address Line 2, Town, County, Postcode, Telephone Number, E-Mail Address, Job Title)
ROOMS (Room ID, Room Type, Room Rate)
BOOKINGS (Booking ID, Customer ID, Room ID, Employee ID, Booking Start Date, Booking End Date, Wake-Up Call, Airport Transportation, Car Rental, Laundry & Dry Cleaning, Newspapers & Magazines, Flowers)
All four of these tables also have forms.
The following fields in the Bookings table are check boxes:
Wake-Up Call, Airport Transportation, Car Rental, Laundry & Dry Cleaning, Newspapers & Magazines, Flowers
The following is what I want to happen with the Bookings form:
I want the employee to select the Customer ID for the customer who is making the booking, the Room ID (the room which the customer will stay in - the hotel has 24 rooms and therefore in the Rooms table there are 24 Records/Primary Keys), the Employee ID (the employee who is making the booking) and the Booking Start Date and Booking End Date.
When I click the 'Save Booking Details' button which is on the Bookings form, I want the system to check whether another booking for the same room lies within the Booking Start Date and the Booking End Date.
The following is an example:
I have made a booking which starts on the 25/12/2014 and ends on 31/12/2014 for room number 6. If I try to make another booking for room number 6 for the start date of 20/12/2014 and the end date of 27/12/2014 or the start date of 23/12/2014 and the end date of 03/01/2015, the double booking should automatically be prevented as it falls in the time frame for when room number 6 has already been booked.
Simply, when I click the 'Save Booking Details' button, it should check whether the booking requested is possible; if it is possible then the booking should be saved as a record in the Bookings table and a message should appear confirming the booking. If not, a message should inform the user that the room is already booked for that time-frame/a double booking was attempted.
I think the solution lies with a VB Code which would be put as the Event Procedure of the button however I kindly request that you provide it. I have looked significantly on the Internet for a solution and haven't found one and I sincerely request your help. Please do not hesitate to request any images of the database.
Kind Regards,
RandomGuy123
Last edited: