Update mainform w/subform changes?

G

GitarJake

Hello all,

(Access2000)

I have a main form with family info and a subform with child info. They
are linked with family ID.

On the main form I have a field, txtFamilyCount, that I want to immediately
display total family members *and* store that number in the mainform's
table.

How do I get Access to immediately recount family members and update
txtFamilyCount after adding a child in the subform?

TIA

Jake
 
V

Van T. Dinh

FamilyCount is a Calculated value and it should not be stored in the Table.
 
G

GitarJake

Hi Van,

Yes, if I calculate the total the FamilyCount updates.

But, I will need that number later in another form. The family info form
will be closed.

How can I either:

1. Calculate and store the family count in the table?

or

2. Pass the calculated total to another form and repeatedly use it as a
variable of sorts?

Thanks for your help,

Jake

PS: My VBA is limited but am willing to dig if someone tells me where!
 
M

Marcus Armand

Set the subfrom after_update property to update the value on the new control
showing the count. You could do this by creating an update query and running
the query from the event procedure. Then refresh the form.

Marcus Armand
 
V

Van T. Dinh

Yes but you can work it out (that's why it is called a Calculated Field)
since the Members of the Family is stored in the "tblPerson". Something
like:

DCount("*", "tblPerson", "[frg_FamilyID] = {whatever})

will give the number of member of the FamilyID {whatever}.
 
Top