I'll try to be brief and clear.
I want a table called "Payments" tied to multiple tables representing multiple types of services offered by a company. It's fairly simple to add a "Payment" foreign key to each of the service tables and link them to the primary key in "Payments", but the problem is a practical one:
I'd like to create a (Libre Office Base) form that adds a payment. But this would require not only doing INSERTs into multiple tables ("Payments" for the info and the given "Service" table for the foreign key), but to add the primary key to a foreign table before the form itself creates that very primary key. So this option seems out.
I attempted to do this the other way - putting a foreign key "Service" into the "Payments" table and insert the IDs (primary keys) from the other tables there, but said primary keys are simple integers and adding say ServiceA's ID = 1 would fool the database into thinking that the ID = 1 object from all the other tables was "paid" as well. I know I could differentiate the IDs between these tables by making them varchars rather than integers, but then I don't think there's a way to make them autofills, right?
Finally, I thought that maybe a "category" option would help - choose from the type of service (for example "Surgery", "Drug sale", "Exam") and then type one of the IDs. That could give me the option to separate the same ID numbers in queries. However, this wouldn't solve the problem that attempting to insert ID = 40 from, say, "Surgeries", while any of the other tables had no such ID, would throw an apparent error, a relationship violation, since the database would think that entry is leading to nowhere.
I'm really struggling to find a simple solution out of this mess. I think the option most fitting for me would be to somehow make autofill primary keys that differ between the tables, but at this point I'll take any suggestion. Is it possible at all in Libre Office Base to create a form that would somehow fit what I want?