Nov 20 2003, 01:07 PM
Can anyone help? I'm designing a database for a villa letting system and I need to ensure that the database will mark the dates that I choose booked so that there are no double bookings. How do I do this?
Nov 20 2003, 01:25 PM
Assuming one booking per day...make the BookingDate a primary key in the table. If you can have multiple bookings per day then it gets more complicated.
Nov 20 2003, 01:34 PM
Do not make the Booking date the primary number in the table. The primary key should not consist of data meaningful to the user. As a general rule the PK should be an autonumber field.
Are yo working with multiple villas or a single villa?
If it is a single villa then you could set the index for the date booked to No Duplicates. Multiple villas would be a different proposition.
If you need more help post back
Nov 21 2003, 04:19 AM
hi thanks loads for your help.
yeah i'm afraid its 13 villas and many bookings need to be made on one day. Nightmare!!!! You sound like a genius though so could you help me again please!!
Nov 21 2003, 04:24 AM
you still having problems
i daily work on a database for a holiday company and can help you alot
Nov 21 2003, 05:17 AM
I'm no genius but if you set up your structure right, it should be fairly straightforward.
Have a table for the thirteen Villas:
Villa_ID (Primary Key, AutoNumber)
Address details etc of Villa
Customer_ID (Primary Key Autonumber)
Address et al
BookingID (PrimaryKey Autonumber)
CustomerID (Number, Long Integer)
VillaID( Number, Long Integer)
Date of Booking
Duration of Booking
Make the Date of booking and VillaID in the tblBookings table an Index (in design view of the table you click on the Idexes tool, Name the Index then list the fields to include in the Index) This will make the combination of the two fields, Unique.
However, this only ensures that a villa cannot be booked twice for the same start day:
Customer A might book Villa 1 for 14 nights on 17/11/03
Therfore villa booked till 01/12/03
Customer B might also book Villa 1 for 7 nights starting 24/11/03
Since the viilaID is the same, but the Date of booking is different, this would be allowed in the index but op course would mean that you are double booked for the last week in November (with two somewhat disgruntled customers )
Some form level validation would probably be the best way to go.
How do you handle it Loonatik (I bow to your experience )
Nov 21 2003, 08:46 AM
thanks u lot, your legends!!!! if you know then cen u help me pls lunatic. i want to ensure that no double bookings are made for each of the 13 villas I have. i'd also like to be able to use the Calendar to select dates so that i can choose a start date of a booking as "1/1/04" for example, and then and end date of "7/1/04" and i would like it to select the dates in between.
how bloody complicated, or maybe i'm just a simpleton!!
Nov 21 2003, 11:00 AM
we are currently using wall boards to show options and bookings however, stick with me because I am just designing an availability form to show if properties are vacant or booked and I will be happy to pass it on to you when it is completed. Anything else you might be interested in? Do you do flights too?
Nov 22 2003, 06:47 AM
Check out the attachment for indicating if there is a duplicate booking. If you need more help don't hesitate to ask
Nov 23 2003, 10:20 AM
cheers Jim, i'll look over that on Monday. I've managed to find an internet site showing how I can use the Calender in Access using Visual Basic but its not allowing me to do bookings or anything with the dates so i'll leave the calendar out!!
Hey Loonatik, thanks 4 yr help, no i'm not doing flights just booking for the villas and whether they need a transfer or not. could i just have a look at how you've done your availability forms, that would be a great help. When do you hope to be finished by?
Nov 24 2003, 07:46 AM
Hey,Sorry to bother u again!! Do you know if I can use the calendar to select dates and put them into some kind of form or table?
Nov 25 2003, 12:48 AM
Hiya, live just south of the river from you, so I can't joke you're too near. Anyways I am working on roughly the same thing as you except mine is an Apart Hotel, and tonight I have finally managed to do something in Access that works. It isn't exactly what I wanted , and may not be what you want but it will give you an idea of how to go about getting it but at least it does work. Have a try.
Nov 25 2003, 03:26 AM
cheers yr a legend!! i'm gonna have a butchers today and i'll get back to u this afternoon some time.
Nov 25 2003, 08:47 AM
hey yeah that was really useful.are u doing yr work for a company?
Nov 25 2003, 08:51 AM
I've attached the basics of what I've done. I know it might seem long winded but I feel more comfortable with less code that I am not always sure how to amend when things go wrong.
They are currently all showing vacant as I am doing the dates for 2004 and only currently have 2003 dates but if you go to bookings and change the dates to 2004 you will see how they work.
Nov 25 2003, 09:03 AM
what website did you find? I'm working on a vacation request calendar and need all of the help I can get.
Nov 26 2003, 03:28 AM
i found it on microsoft msdn site, its quite good. just look up calendar 9.0 or 10.0. i hope thats some help
Nov 26 2003, 03:31 AM
i can't find the attachment in your message!!!!! could u send it again please.
Nov 26 2003, 05:25 AM
sorry could u help me out again pls? i must be really peeing u off!!
there are 13 families that own the 13 villas on the same complex and so if a booking is made, the money will be split 13 ways. they therefore want each booking to be made to go to the next villa. for example:
if i make a booking, i will be in villa1, i want the next booking to be in villa 2 and then villa 3 and so on.
do u know if i can get the system to automate that, so it moves on to the next villa?
Nov 27 2003, 04:39 AM
i have a booking form for villas and i am using a calendar to select the date RANGE however, I need it then to select all dates within that range and if possible highlight them on the calendar. does anyone know how?
Nov 30 2003, 09:55 AM
I have done mine the other way round. Not selecting by date but selecting by property. So for each property staff can look at the 30 weeks we are operational and see which weeks are free for each property. I am going to set up forms so that you can either select by property or by date to see whats free. This is what I am doing next week and can post as soon as I've completed.
Dec 1 2003, 04:52 AM
Can I see a copy of the structure of your DB. It sounds close to what i'm struggling with.
Thankz in advance,
Dec 1 2003, 06:14 AM
i'm doing it!
Dec 1 2003, 09:14 AM
you need to base your query on the form field of start date or whatever you have called it. When we have bookings we select optioned/booked/cancelled on the booking form.
To query I created a query and in the first line of the query type =IIf([Start Date] Between #01/03/04# and #31/03/04#,[Status],"Vacant") - the query also includes the villa names and codes. I actually have a few dates not just start date, so if you have more than one date field let me know.
Where [status] is the optioned/booked/cancelled field.
Do this for each date selection that you require and make a form from this. I am not using any calendar feature
Dec 3 2003, 07:42 AM
thanks that might help. but does your system only have the option of selecting a certain week or any date in the year within those that you are operational?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here