Restricting records (1 Viewer)

tilda

Registered User.
Local time
Today, 11:29
Joined
May 10, 2001
Messages
17
Hi Folks
Small problem here if any one can help!

I have two tables with a one to many relationship, does anyone know how to restrict the amount of records entered on the many side. For example if we have student details on the one side, some are only allowed to take five courses, my problem is how to restrict the amount of courses on the many side. If this makes sense to anyone please let me know if it can be done.


Thanks in advance
Tilda
 

shay

Registered User.
Local time
Today, 11:29
Joined
Apr 29, 2002
Messages
169
One solution is to have an integer field CourseNo in your 'many' table with validation rule '<=5'.

However, if the 'no more than 5 courses' rule only applies to some students, you'll probably need to use code to do what you want.

hth

shay :cool:
 

tilda

Registered User.
Local time
Today, 11:29
Joined
May 10, 2001
Messages
17
Hi Shay

Thanks but unfortunately students can do different amounts of courses, but it does need to be controlled.

Tilda
 

ColinEssex

Old registered user
Local time
Today, 11:29
Joined
Feb 22, 2002
Messages
9,116
Just thinking through this quickly - perhaps you can have a field on the student ID screen that you enter the number of courses that a student can do.

Then you can have some code (like a DCount or something) that counts up the number they have already registered for. If that number = the number they can take then don't allow the courses screen to accept any more new courses for that student.

Col
:cool:
 

tilda

Registered User.
Local time
Today, 11:29
Joined
May 10, 2001
Messages
17
Hi Colin
Yes I can try that; the extra field is not a problem. Would I do the code in the form?

Tilda
 

ColinEssex

Old registered user
Local time
Today, 11:29
Joined
Feb 22, 2002
Messages
9,116
That would be best

Put it in the OnCurrent property 'cos it'll have to run for every record you view.

Col
:cool:
 

tilda

Registered User.
Local time
Today, 11:29
Joined
May 10, 2001
Messages
17
Thanks Colin
I'll give it a go
Tilda

PS Everyone have a Super Christmas
 

Users who are viewing this thread

Top Bottom