Tom,
Isn't there a variable in SQL Server that gets set to contain the value of the last auto created Id field? - @@IDENTITY ?? or something similar?
You can query SQL Server to return this id and then use it for your child records:
SQLEXEC( lnHandle, 'SELECT @@IDENTITY AS Id', 'mycurs')
and then look at mycurs.id
HTH
regards
Ian