473,378 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Validation to check a record of the same date and time

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
3 1508
ADezii
8,834 Expert 8TB
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
Thank-you very much :)
Jul 18 '07 #3
ADezii
8,834 Expert 8TB
Thank-you very much :)
You are quite welcome.
Jul 18 '07 #4

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

Similar topics

21
by: Stefan Richter | last post by:
Hi, after coding for days on stupid form validations - Like: strings (min / max length), numbers(min / max value), money(min / max value), postcodes(min / max value), telefon numbers, email...
6
by: MickG | last post by:
Hi, I am trying to validate these values, this seems to work fine for the phone number and name but I am trying to get the program to fail to submit and set the focus on the date when 2006 is...
0
by: Steve V | last post by:
I'm using Access 2000 to build a budgeting/tracking database. Can I make a validation rule (using VBA) that checks the data as if the record has already been added? I've got 5 tables (only the...
18
by: Steve | last post by:
Hi I have a really weird problem and any assistance would be welcome. I have developed an app in Access 2002. The app runs perfectly on the development machine. I have packaged the app using...
11
by: Rik | last post by:
Hello guys, now that I'm that I'm working on my first major 'open' forms (with uncontrolled users I mean, not a secure backend-interface), I'd like to add a lot of possibilities to check wether...
5
by: starke1120 | last post by:
Im creating a check in – check out database for RF guns. I have a table that contains models. ID (primary key) Model A table that contains Gun Details ID (primary key) Model_id...
7
ak1dnar
by: ak1dnar | last post by:
Hi, I got this scripts from this URL There is Error when i submit the form. Line: 54 Error: 'document.getElementbyID(....)' is null or not an object What is this error. Complete Files
3
by: rn5a | last post by:
A MS-Access DB table has the following 6 columns - TeacherID, ClassID, VenueID, AvailDate, StartTime & EndTime. The data type of the 1st 3 columns is int whereas the data type of the last 3 columns...
3
by: Harlequin | last post by:
I must start this posing by making the point that I am NOT a VB programmer and I'm something of a Newbie to MS Access. I can program in a number of languages (Java, Javascript, PERL,PHP and TCL) but...
1
balabaster
by: balabaster | last post by:
Hi guys 'n gals, I'm having an issue wrapping my head around a check constraint that I need to set on a table in my database. Table: OnCall Columns: OnCall_PKey (identity), Person_Key,...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.