Inserting a row into a table with Referential integrety

Hi,
How do you insert a record into either the parent or the child of a table where it is connected to another table through reverential integrity? I get forgin key error be cause it is connected to another table through a forging primary key constraint; which is how it is supposed to work, but how do you add records with these constraints ?

Thank you.

Insert the row in the referenced table(s) first, and then into the referencing table(s).

That worked thanks