By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,456 Members | 1,952 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,456 IT Pros & Developers. It's quick & easy.

Validation to check a record of the same date and time

P: 2
Hi guys,

Any help will be VERY helpful here!

I'm making a booking database but there can't be two or more bookings at the same date and at the same time.

How do i write the validation script for this?

Thanks in advance
Jul 16 '07 #1
Share this Question
Share on Google+
3 Replies


ADezii
Expert 5K+
P: 8,597
Hi guys,

Any help will be VERY helpful here!

I'm making a booking database but there can't be two or more bookings at the same date and at the same time.

How do i write the validation script for this?

Thanks in advance
Perhaps the most efficient way is to create a Composite, Unique Index on the [Booking Date] and [Booking Time] Fields. This system will not allow 2 Records with the same Booking Date and Time. Here is how you do it. For demo purposes only, I'm naming your Table tblBookings, and your Date and Time Fields [Booking Date] and [Booking Time]:
  1. Open the Database Window and select tblBookings.
  2. Click on Design to enter the Design Window for tblBookings.
  3. Click on View, then Indexes.
  4. Under Index Name enter Booking.
  5. For Field Name enter Booking Date.
  6. The Sort Order is irrelevant for our purposes.
  7. Set the following Properties.
    1. Primary: No
    2. Unique: Yes
    3. Ignore Nulls: No
  8. In the next Row, under Field Name, enter Booking Time. Do not repeat the Index Name in this 2nd Row.
  9. Close the Indexes Window - you have now created a Composite, Unique, Non-Primary, Index on the [Booking Date] and [Booking Time] Fields.
Jul 16 '07 #2

P: 2
Thank-you very much :)
Jul 18 '07 #3

ADezii
Expert 5K+
P: 8,597
Thank-you very much :)
You are quite welcome.
Jul 18 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.