Can a one-to-many relationship be restricted?

  • Thread starter Thread starter ElaineLittle
  • Start date Start date
E

ElaineLittle

Guest
Is it possible to restrict a one-to-many relationship so that the many side could be restricted to say 4 records? For example a student can take four courses (no less, no more)
 
I may be wrong, but I think that would need to be enforced via your forms, as i don't think it can be done in the relationship itself.
 
yes but this would have to be done in your forms thru code in the Before Insert event:

IF DCount("[StudentID]","tblCourses","[Studentid] = " & ME.txtStudentID) > 4
Then
MsgBox "Only 4 courses allowed"
Me.Undo
End If
 
This will be fun to set up as well, as all four records will have to be created but not saved, until all four are ready, to meet the requirement for exactly four courses

Peter
 

Users who are viewing this thread

Back
Top Bottom