Wolfgang,

If you are staying with this type of approach then let me offer one change to what I put up before:

sub onInsertRecords

dim stmt

dim rs

dim FK_Val

   '......

   'get connection and create statment

   '

   FK_Val = InsertMaster( Stmt, oDialog.GetControl("txtBox1").text )

   InsertChild( Stmt, FK_VAL, oDialog.GetControl("txtBox2").Text )

   .....

   'do the same fo the other aliases

   .....

end sub

function InsertMaster( aStmt as variant, aName as string ) as integer

dim rs as variant

   aStmt.executeUpdate( "INSERT INTO ""Table1"" ( ""NAME"" ) VALUES ( " + aName + " 
) " )

   aStmt..executeQuery( " CALL IDENTITY() " )

   rs.next

   InsertMaster = rs.columns(0).getInt

end sub

sub InsertChild( aStmt as variant, aFK as integer, aAlias as string )

   aStmt.executeUpdate( "INSERT INTO ""Table2"" ( ""ID2"", ""Alias"" ) VALUES ( " + aFK + ", 
" + aAlias + " )" )

end sub


HTH,

Drew

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to