How to insert data into multiple tables

I have two tables in corvid database (Events , Event Details)

I have a reference field of Events in Event Details
I have connected submit button with Event Details dataset but I also need to send data to Events table, as I click on submit the data inserts into Event details table only not the connect field of events table.

I also need to automatically increment the id of tables.

I have also related question. Hopefully , you will get solution.

You probably want to use a collection hook.

The beforeInsert hook on the event details collection will let you increment the value for the counter. You’ll also be able to insert a copy of the item into events collection

https://www.wix.com/corvid/reference/wix-data.Hooks.html#beforeInsert
https://support.wix.com/en/article/wix-code-how-to-use-data-hooks