limiting number of child fields per parent

mech55

Registered User.
Local time
Today, 15:05
Joined
Aug 26, 2005
Messages
61
I have a field in the parent table which indicates how many child tables there should be at the most. I'm uncertain about how to enforce this. I"m using access as the database to a Vb.net app. Should I do it in access or Vb.net or both.
 
mech,

In Access, you can use the DCount function:

TotalRecords = DCount("[ChildKey]", "ParentTable", "[ChildKey] = " & Me.ChildKey)

That's pretty easy.

If you want to limit the number, use the BeforeInsert event of the form and Cancel
the Insert if TotalRecords exceeds some threshhold.

Wayne
 
mech55 said:
I have a field in the parent table which indicates how many child tables there should be at the most. I'm uncertain about how to enforce this. I"m using access as the database to a Vb.net app. Should I do it in access or Vb.net or both.

I'm not getting why this is an issue! The number of child tables is dependent on the needs of the database. There should be no need to count or restrict them. Why are you doing so?
 
Hi Pat,
I'm confused. I can see where one would want to limit the number of child RECORDS. I've done that on occassion. But Mech55 said he is limiting the number of child TABLES. Maybe he used the wrong term, but I don't see why one would limit the number of child tables.
 
Well you know what they say about "assume" ;) I preferred not to make that assumption.
 

Users who are viewing this thread

Back
Top Bottom