473,890 Members | 1,216 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple DB Column validation

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 is Date/
Time. The AvailDate column stores only the date (& not the time) where
as the last 2 columns store only the time (& not the date). Assume
that the 1st record in the DB table is ClassID=1, TeacherID=1,
VenueID=1, AvailDate=5/15/2007, StartTime=7AM & EndTime=8AM. This
means that ClassID=1 has already been booked by TeacherID=1 at
VenueID=1 on 15th May 2007 from 7AM to 8AM.

Now I have to ensure that no conflicts arise when users enter records
in these 6 columns. The conflicts could be the following:

A teacher cannot teach 2 classses on the same date & at the same time
(be it in the same venue or a different venue). For e.g. TeacherID=1
cannot teach ClassID=1 & ClassID=2 on 15th May 2007 from 7AM to 8AM.
Hence if a user wants ClassID=2 to be taught by TeacherID=1 on 15th
May from 7AM to 8AM, he shouldn't be allowed since ClassID=1 will be
taught by TeacherID=1 on 15th May from 7AM to 8AM (as the 1st row
says).

Likewise, one class cannot be taught by 2 teachers on the same date &
at the same time (be it in the same venue or different venues). For
e.g. ClassID=1 cannot be taught by TeacherID=1 & TeacherID=2 on 15th
May 2007 from 9AM to 10AM. Hence if a user wants TeacherID=2 to teach
ClassID=1 on 15th May from 7AM to 8AM, he shouldn't be allowed to
enter this data in the DB table since ClassID=1 will be taught by
TeacherID=1 on 15th May from 7AM to 8AM.

Similarly, one teacher/class cannot be at 2 venues on the same date &
at the same time. For e.g. TeacherID=1/ClassID=1 can't be at VenueID=1
& VenueID=2 on 15th May 2007 from 11AM to 12PM respectively. Hence if
a user wants TeacherID=1 to teach ClassID=1 on 15th May from 7AM to
8AM at VenueID=2, he shouldn't be allowed to enter this data in the DB
table since ClassID=1 will be taught by TeacherID=1 on 15th May from
7AM to 8AM at VenueID=1.

Also if a user wants to add another row in the DB table where
ClassID=1 will be taught by TeacherID=1 at VenueID=1 on 15th May from,
say, 7:15AM to 8:15AM, this row should not be allowed in the DB table
since the time slot from 7AM to 8AM has already been booked by
ClassID=1 (who will be taught by TeacherID=1); So can TeacherID=1 (or
any oother teacher) start teaching from the middle of a session.

I have made a start but am not exactly confident about it. What I did
is compared each Form inout data with the corresponding columns in the
DB using the following WHERE clause in the SQL query:

SELECT.....WHER E ClassID=Request .Form("classid" ) AND
TeacherID=Reque st.Form("teache rid") AND
VenueID=Request .Form("venueid" ) etc.....

If such a record exists in the DB, then the question of inserting it
in the DB doesn't arise only. So far so good but what do I do if such
a record doesn't exist? Compare the ClassIDs; if ClassID exists, then
next compare TeacherIDs but even if ClassID entered by the user
doesn't exist, that record cannot be inserted in the DB. Under such
circumstances, the next validation that needs to be done is to find
out whether the TeacherID posted by the Form is already booked at the
input VenueID data on the input AvailDate date from input StartTime
data to input EndTime data so on & so forth & this becomes very
confusing.

Can someone help me out with this?

Thanks,

RON

May 13 '07 #1
3 1498
On May 14, 12:10 am, r...@rediffmail .com wrote:
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 is Date/
Time. The AvailDate column stores only the date (& not the time) where
as the last 2 columns store only the time (& not the date). Assume
that the 1st record in the DB table is ClassID=1, TeacherID=1,
VenueID=1, AvailDate=5/15/2007, StartTime=7AM & EndTime=8AM. This
means that ClassID=1 has already been booked by TeacherID=1 at
VenueID=1 on 15th May 2007 from 7AM to 8AM.

Now I have to ensure that no conflicts arise when users enter records
in these 6 columns. The conflicts could be the following:

A teacher cannot teach 2 classses on the same date & at the same time
(be it in the same venue or a different venue). For e.g. TeacherID=1
cannot teach ClassID=1 & ClassID=2 on 15th May 2007 from 7AM to 8AM.
Hence if a user wants ClassID=2 to be taught by TeacherID=1 on 15th
May from 7AM to 8AM, he shouldn't be allowed since ClassID=1 will be
taught by TeacherID=1 on 15th May from 7AM to 8AM (as the 1st row
says).

Likewise, one class cannot be taught by 2 teachers on the same date &
at the same time (be it in the same venue or different venues). For
e.g. ClassID=1 cannot be taught by TeacherID=1 & TeacherID=2 on 15th
May 2007 from 9AM to 10AM. Hence if a user wants TeacherID=2 to teach
ClassID=1 on 15th May from 7AM to 8AM, he shouldn't be allowed to
enter this data in the DB table since ClassID=1 will be taught by
TeacherID=1 on 15th May from 7AM to 8AM.

Similarly, one teacher/class cannot be at 2 venues on the same date &
at the same time. For e.g. TeacherID=1/ClassID=1 can't be at VenueID=1
& VenueID=2 on 15th May 2007 from 11AM to 12PM respectively. Hence if
a user wants TeacherID=1 to teach ClassID=1 on 15th May from 7AM to
8AM at VenueID=2, he shouldn't be allowed to enter this data in the DB
table since ClassID=1 will be taught by TeacherID=1 on 15th May from
7AM to 8AM at VenueID=1.

Also if a user wants to add another row in the DB table where
ClassID=1 will be taught by TeacherID=1 at VenueID=1 on 15th May from,
say, 7:15AM to 8:15AM, this row should not be allowed in the DB table
since the time slot from 7AM to 8AM has already been booked by
ClassID=1 (who will be taught by TeacherID=1); So can TeacherID=1 (or
any oother teacher) start teaching from the middle of a session.

I have made a start but am not exactly confident about it. What I did
is compared each Form inout data with the corresponding columns in the
DB using the following WHERE clause in the SQL query:

SELECT.....WHER E ClassID=Request .Form("classid" ) AND
TeacherID=Reque st.Form("teache rid") AND
VenueID=Request .Form("venueid" ) etc.....

If such a record exists in the DB, then the question of inserting it
in the DB doesn't arise only. So far so good but what do I do if such
a record doesn't exist? Compare the ClassIDs; if ClassID exists, then
next compare TeacherIDs but even if ClassID entered by the user
doesn't exist, that record cannot be inserted in the DB. Under such
circumstances, the next validation that needs to be done is to find
out whether the TeacherID posted by the Form is already booked at the
input VenueID data on the input AvailDate date from input StartTime
data to input EndTime data so on & so forth & this becomes very
confusing.

Can someone help me out with this?

Thanks,

RON
No one who can help me? My bad luck.....Please ....can someone PLEASE
help me resolve this complex validation..... PLEEEEEEEASE... ..I
desperately need a concrete solution.....I am on the verge of losing
my job.......PLEEE EEEASE.......

RON

May 14 '07 #2
rn**@rediffmail .com wrote:
No one who can help me? My bad luck.....Please ....can someone PLEASE
help me resolve this complex validation..... PLEEEEEEEASE... ..I
desperately need a concrete solution.....I am on the verge of losing
my job.......PLEEE EEEASE.......
You posted a question on a Sunday and expected a solution already? Sorry,
but that's not the way newsgroups "work". You may wish to consider another
means of getting help - perhaps hiring a programmer who will work to your
schedule, rather than appealing to a group of people with their own lives
and schedules to consider before taking time to tackle a considerably
complicated problem.

If nobody has porovided a solution by tonight, I will try to remember to
take a look at it after work today.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
May 14 '07 #3
On May 14, 3:58 pm, "Bob Barrows [MVP]" <reb01...@NOyah oo.SPAMcom>
wrote:
r...@rediffmail .com wrote:
No one who can help me? My bad luck.....Please ....can someone PLEASE
help me resolve this complex validation..... PLEEEEEEEASE... ..I
desperately need a concrete solution.....I am on the verge of losing
my job.......PLEEE EEEASE.......

You posted a question on a Sunday and expected a solution already? Sorry,
but that's not the way newsgroups "work". You may wish to consider another
means of getting help - perhaps hiring a programmer who will work to your
schedule, rather than appealing to a group of people with their own lives
and schedules to consider before taking time to tackle a considerably
complicated problem.

If nobody has porovided a solution by tonight, I will try to remember to
take a look at it after work today.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob, after going through your post (especially the last paragraph), I
can at least breathd a sigh of relief. Thanks a lot for that.

Actually the circumstances I am in prompted me for the follow-up post
though I know that it's quite a complicated task. I guess I am
expecting a bit too much from others & I am extremely SORRY for that.
Looking forward to your......

Thanks once again,

Regards,

RON

May 14 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2617
by: Red | last post by:
Hi, I'm not very familiar with Javascript. I usually leave that kind of stuff up to Dreamweaver, but i'm starting to need a little more than it can offer. I have an asp page which creates a form from a record set. Very simply it lists items that can be ordered by the customer. The customer simply enters the required qty for each item and hits submit:
8
579
by: TJS | last post by:
what are folks doing to get around limitation of one server form per page ?
1
3924
by: Ken Varn | last post by:
If a page has multiple ValidationSummary controls, how does it distinguish which ValidationControls are associated with which ValidationSummary controls? The reason I am asking this is that I want to display a Message Box for the validation message on my Validation controls. My validation control is embedded within a custom server control. If my custom server control adds a ValidationSummary control, I am afraid that it may conflict...
1
5280
by: cemcat | last post by:
Hello, We have an ASP.NET 2.0 (C#) web form that contains a textbox for users to enter multiple e-mail addresses separated by semicolons. We need to validate that each individual e-mail address entered is a valid e-mail address format. We've added a CustomValidator to perform this validation. We have the server-side validation working fine, but now we need to add some client-side validation via JavaScript. We are having difficulties...
5
4958
by: paul_zaoldyeck | last post by:
does anyone know how to validate an xml file against multiple defined schema? can you show me some examples? i'm making here an xml reader.. thank you
7
15668
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is there an equivalent property for the DataGridView? I have searched, but have not found one. I would like the user to be able to see all the columns of the table on one screen - thus eliminating the need to use the horizontal scroll bar to view...
3
6254
by: sejal17 | last post by:
hello Can any one tell me how to read multiple worksheets from a single excel file.I have stored that excel in xml file.so i want to read that xml that has multiple worksheet.And i want to store that multiple worksheet data in different table.How can i do it.Below is my xml file. <?xml version="1.0"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" ...
8
10502
by: preeny8 | last post by:
Hi guys, So I'm editing an existing database (Access 2003), and I need a bit of help in making a validation rule. My table has many fields, 3 of which are indexed (location, number & revision) Each of these 3 fields can have duplicates (Same location can exist for multiple items, same number can exist for multiple items, and same revision can exist for multiple items). However, all 3 fields cannot be the same in multiple records (Ex.....
0
9978
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9821
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11229
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10923
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9630
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7169
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
4271
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3276
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.