For MS Access, how to count records in Child Table and display in related Parent Table?
Saturday, October 31st, 2009I have 2 MS Access tables:
(1) Blogs with columns:
"BlogID" (primary key, AutoNumber), "DateNTime", "BlogEntry"
(2) Comments with columns:
"BlogID" (foreign key, Number), "CommentID" (AutoNumber), "CommenEntryt"
I have set a relationship between these two tables where Blogs is the parent table while Comments is the child table. By the way, am I right to call "BlogID" in Comments table "foreign key"?
This should work rather simple. Every time I enter a new BlogEntry, a BlogID will be generated automatically. When someone enter a BlogComment corresponds to a BlogID, CommentID will be generated automatically. So now, I would like to add a new column under BlogID to count how many BlogComment s are there under each BlogID. How can I do that?
I heard that I can do it by creating a query but I don’t know how to do so. Can someone please teach me?
Thanks a lot…
create the wuery you require then use the field you want to count on then use the sigma sign next to the red excamation mark.
There will be a new row at the bottom with a group by in it change it to count.
the jobs done.
If you put the same field in twice one group by the next count you will se what I mean.
Have a go if you get stuck contact me