Require a child record (on Subform)?

D

D. Shane Fowlkes

Hello all!

I have a simple form which also has a subform in it where child records can
be written to a child table based on the parent record/form. I would like
to make it required that the user enter/pick at least one child record (buy
many are possible). As it is now, it's not required.

Is there some simple attribute using Access 2003 in the form or subform I
can set to make a child record on the subform be required instead of
optional?

Think of the tables/forms like shown below As my form is designed now,
someone could enter "Bob" in the form and never pick if he has one or more
certifications...which should be required. Make sense?


StaffTable:
ID | PersonName
---------------------
1 | Bob
2 | John


CertificationsTable
ID | CertName
-----------------------
1 | Juggling
2 | Yoddling


CertStaffMatch
ID | StaffID | CertID
 
G

Guest

One way would be to use the dcount function. After the user has entered the
parent data and the record has been saved, run something like the following
to see how many child records there are for the parent:

dcount("StaffID","CertificationsTable","StaffID = form.StaffID")

If 0 is returned, then no child records have been entered

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top