access forms validation rules confused

frostless

New member
Local time
Tomorrow, 01:42
Joined
Jul 20, 2015
Messages
5
Hi all.

I am doing an assignment and I am stuck at this validation rule. I could not figure it out myself so I really need your helps here: :(:mad::banghead::banghead::banghead:

So in my database I 've got one table named horse and the rules I am supposed to set are these two:
1:A horse cannot be added that does not already have a Dam and Sire existing in the database unless either or both are not known.
2:A horse must not be deleted if it is the Sire or Dam of an existing horse.

I guess I am supposed to create a data entry form for table horse and apply these two rules in the form, but what should I do to achieve that?
Seems a bit complicated cause the entering need to check some other fields (sire and dam) in the table..

My table looks like this

Horse_id Name Colour Sire Dam Born Died Gender
101 Flash white 201 301 2001 0 S
102 Star brown 201 302 2002 0 M
201 boxer grey 401 501 1991 0 S
301 Daisy white 401 502 1992 0 M

I know it might seem too simple to you but I am a full-time worker doing this online course. The consulting resouce for me and the time are both quite limited.

Really appreciaye your help!!
 
Welcome to the Forum! :D

Hmm, seems to me you're going to need more than one table. Think people/families and have a look here...
http://allenbrowne.com/AppHuman.html

Once your tables are set you can enforce referential integrity and leave the check mark out of cascade deletes. As for the additions, sounds like no new horses so you can set up your Form to only accept Dam or a Sire where there is an existing Horse but not allow new ones.
 
Last edited:
I can understand you are confused, because this model is way too complex for a beginner study. Have you skipped some lessons?

In any case, I disagree with GinaWhipp. Your table is just fine as is - it contains a so-called ajacency list. An adjacency list model is one where you in a record store the ID of the record to which current record is related - like a parent (or here, two parents).

In the Relationships window, click on your tblHorses (if that is what it is called) in ShowTable 3 times. You'll get tblHorses, tblHorses_1 and tblHorses_2.

drag the field Horses_ID form tblHorses onto Sire in tblHorses_1


drag the same field Horses_ID from tblHorses onto Dam in tblHorses_2

Update: all this has little to do with form validation rules, but all to do with Referential Integrity (RI), as Gina also mentioned. RI ensures that a child can only have a parent that already is in the table (or Null) and that you cannot delete a parent if that parent has one or more children (unless you check Cascade Delete, which should only be done if you fully appreciate the consequences).
 
Last edited:

Users who are viewing this thread

Back
Top Bottom