Get Related Record Count and Display in Parent Table.

Get Related Record Count and Display in Parent Table.

I have a table called "Contacts".  I also have a table called "Pets".  I want to display the "Contacts" table with a field called "Pet Count" which would display the number of related records in the pet table/form.  I have an ID field linking the two tables.  Contacts.ID = pets.Contact_ID.  

I would like my table to look like this:

First Name | Last Name | Pet Count

I know that I have to either use a formula field or a script that will set the Contacts.Pet_Count field with the related record count, I just can't seem to get it right.  I want the script to run on "Contacts" table load no on form save.

I need the table to update the information every time the table loads in case new pets have been added.  Any help would be appreciated.  Thanks.

Thank you.