Advice on Header and Detail tables

I want to write out data to two tables at the same time… a Header and a Detail.

A Simple Example:
(PK) = Primary Key, AutoNumber field in MySQL

Schema:
Header = RecNbr(PK), Name
Detail = RecNbr(PK),HeaderRecNbr, FavColor

So when I write data I want to create a record in the header, then use its RecNbr to write the detail record(s).

What is the best method to do this, when multiple users will be adding records from the same application at the same time?

Thanks!

I am digging around the Internet trying to determine the best method for this… I have come across MySQL specific function: [SIZE=14px]mysql_insert_id[/SIZE]SIZE=14px[/SIZE]

But when I try to use that in my Scriptcase 8 Control Application in the OnValidate event I get this error box.
[TABLE=“class: scFormErrorTable, align: center”]
[TR]
[TD=“class: scFormErrorTitle, align: left”] [TABLE=“width: 0”]
[TR]
[TD=“class: scFormErrorTitleFont”]Error [/TD]
[TD][/TD]
[/TR]
[/TABLE]
[/TD]
[/TR]
[TR]
[TD=“class: scFormErrorMessage, align: center”]mysql_insert_id(): Access denied for user MYUSERHERE (using password: NO)
mysql_insert_id(): A link to the server could not be established[/TD]
[/TR]
[/TABLE]

Is there a better method to getting the last inserted ID I should be using for detail (Children) records?