if I have understood your problem, you can use the following script:
If[Get ( ScriptParameter ) = 1]
Set Next Serial Value[Table1::IdField1; GetNextSerialValue ( Get ( FileName );"Table2::IdField2")]
Set Next Serial Value[Table2::IdField2; GetNextSerialValue ( Get ( FileName ); "Table1::IdField1")]
Set this script in the Script trigger on layout OnrecordCommit event
In Layout for Table1 pass the parameter 1
So , when it is committed the new record in one of the two tables, the script set the next serial equal to the other table (which was already incremented)
Do the two forms refer to the same table or different tables?
If they refer to the same table occurrence, they will stay in synch automatically.
If different table occurrences, a script performed from one layout can perform a find for the record with matching value in the other.
If you want a new record created in one layout's table to match the ID number of the current record in the other table, things get more complicated. This last situation implies a relationship between the two tables. Is it a one to one relationship, (Exactly one record in table 1 matches by this ID number to exactly one record in the other table), a one to many relationship (many records in table 2 have match to the same ID number in table 1) or a many to many relationship?