Jump to content
Server Maintenance This Week. ×

Count Records in Related Table


This topic is 2351 days old. Please don't post here. Open a new topic instead.

Recommended Posts

This is pretty a simple request that does not seem to work. I have two tables Parent and Child. I want the Parent record (of which there is only) to display the number of Child records in each parent set. In the Child table I have field 'k one' (a calc with a value of 1). In the Parent I have a calc field Count(Child::k one). No matter what I do the value is always 1 on all of the parent records, but it should read 25, 65, 44, etc depending on the number of child related records. What am I missing?

Thanks in advance,

David

Link to comment
Share on other sites

First place to check is to make sure the calculation is unstored (in the field definition dialog, click options, then Storage options, then check the "Do not store..." checkbox.

Link to comment
Share on other sites

Yes it is unstored. The relationship works for other uses, just not for the Count function. This is so simple and also very confusing.    This is the calc:   Count ( Tracks::k one )

Link to comment
Share on other sites

To me, there are better ways to count child records:

1. create a summary field in the child table, count_of_records = count of primary key. Display that field on the parent form.

2. create a count (relationship_from_parent_to_child::child_primary_key) in the parent table.

3. Use SQL.

Really no need for a dedicated "k one" field in the child.

Link to comment
Share on other sites

I also tried option1. The calculation in the child table is correct, but when I display that in the parent table it is 0. It is almost like it is totally ignoring the relationship, but the relationship is simple connection of two number fields that DO match.

Just for reference I tried  approach 1 & 2 in a new solution and it worked fine.

Link to comment
Share on other sites

This topic is 2351 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.