You may not need any button at all to do that. Whether you do or not, you'll need a relationship defined in Manage | Database | Relationships that looks like this:
Clients----<Pets (I'm guessing that a client may have more than one pet here)
Clients::__pkClientID = Pets::_fkClientID
For an explanation of the notation that I am using, see the first post of: Common Forum Relationship and Field Notations Explained
Here's a method that does not need any such button:
Double click the relationship line between Clients and Pets to open the Edit Relationship dialog. Click "allow creation of records via this relationship" on the Pets side of the relationship.
Now, if you place a portal to Pets on the Clients layout, you can add new Pets records by entering data directly into the portal. FileMaker will update _fkClientID for you with the correct matching value to link it to the current record on your Clients layout.
And if you still want that button, set it up to perform this script:
Set Variable [$ClientID ; value: Clients::__pkClientID ]
Go to Layout ["Pets" (Pets) ]
Set Field [Pets::_fkClientID ; $ClientID ]
Go to Layout [original layout ]
If you want to stay on the Pets layout so that additional data can be entered, remove the last script step from this script.
OMG... If I realised I would get a reply that fast I would have stayed in front of my desktop lol.
i have been watching a whole load of tutorials on YouTube, but none explained it that simply. I will try this method later.
thank you for your time... Very much appreciated.