How to create record of another table in a form

Hello everybody,

I have recently created my first database with LO Base. I then created the various forms for entering data in my tables.
I have set up the form of the main table so that I can fill its various fields with the keys chosen from the relative drop-down menus. I was wondering if there is a way to create a record “on the fly” when it is not already present in the drop-down menu.
I try to explain myself better, giving an example:
I have this form to enter the data of an employee, I arrive at the field of the city of origin, I open the drop-down menu that allows me to choose between the various cities already in the database, but I need to select a city that is not yet been added to the cities table (for example, Berlin). So is there a way to add the Berlin record (with all its other fields, for example country of origin, telephone area code, etc.) directly from the employee form?
Thanks in advance to anyone who wants to help me.

Even a link to a written guide or a video tutorial on YT would be much more than enough (I have no idea what the name of the function I’m looking for is called…).

You could do this with macros. Look a the Base Guide for this.

The simple way is the following way: On the drawpage is your MainForm. Create (with Form Navigator) a form beside this form, for example for the cities. Only allow input for new data to this form. Create a table control, which needs only one row. The wizard will choose all fields of the table “cities”. Here you could input new cities.

After adding a new city you have to go to the list field for cities and have to refresh the field. There is a button in the navigation bar for this.

Hi RobertG, and thanks for your reply!

I have looked at the guide for macros and unfortunately I have to admit that it is beyond my poor skills.
So I would try to follow the second path you suggested, provided that they are two separate ways and that it is not a continuation of the use of macros (?)…
It is not clear to me through which screen I should create the cities form: within the editing screen of my main form, or as if I were creating any “normal” form?

The second way is the way without macro. Download the Base Guide. There is a database shown on page 178. There are 6 table controls on the right, which could be used to add content, which is missed in the list fields of the main form.

I you have problems to add such a field: You could send me the database with private mail so I will insert one of the table controls in your main form.

1 Like

Dear RobertG,
I thank you infinitely for your kindness and for your assistance. As soon as I have a moment I study the guide well and try to follow the advice you provided me, thank you very much also for offering me an example to follow, but I would like to try to solve it by myself first, to understand how to do it also in the future (I plan to apply these steps also for another database that I have already done with SQLite and which is composed of more than 200 tables linked together).