Form with several tables

Discuss the database features
Post Reply
emanuelebrilli
Posts: 2
Joined: Wed Oct 10, 2018 5:44 pm

Form with several tables

Post by emanuelebrilli »

Hi, I hope someone can help me :D

I have create a form with several datas that are save in two different tables... When i fill my form how can i save these different datas on the tables?
Attachments
Tabella.JPG
OpenOffice 3.1 on Windows Vista
UnklDonald418
Volunteer
Posts: 1544
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Form with several tables

Post by UnklDonald418 »

If I understand you correctly, data that you type on your form doesn't get saved to your tables.
That problem is usually caused by not having a control on your form for the Primary Key value for the table(s). Without a control for the Primary Key, the form doesn't know which record to tell the database engine to update, so the form becomes read only.
Try adding a Formatted Field control with the Datafield set to the Primary Key field, one for Table1 and another one for Table2.
If the Primary Key is auto generated, the control can have its Visible property set to No so the user doesn't see it when using the form, but it must still exist on the form.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
emanuelebrilli
Posts: 2
Joined: Wed Oct 10, 2018 5:44 pm

Re: Form with several tables

Post by emanuelebrilli »

i'll try to be more clear.

1) i have build that form where i can search people (infact i have more than 40 records from the table1), and i can also change datas of that!
record format.JPG
However i have a problem because in that form i want add datas from a table2 with a dropdown menù. The table1 and table2 are link togheter in that way:
link.JPG
I would like have a form that allow me to search/modify and add datas of people from the table1 and also allow me to search/modify and add datas from table2.

2) People that are in table1 are link to tables2 with the ID: "Numero Tessera".

3) How can i update the table2 from the datas of table1?

4) these are the options of the form... I think the problem is that it brings datas from the table1 ("t_Anagrafiche"):
database.JPG
OpenOffice 3.1 on Windows Vista
UnklDonald418
Volunteer
Posts: 1544
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Form with several tables

Post by UnklDonald418 »

I would like have a form that allow me to search/modify and add datas of people from the table1 and also allow me to search/modify and add datas from table2.
A properly designed MainForm/SubForm combination where MainForm uses one table as its data source and SubForm uses a different but related table as its data source allows data in both tables to be edited.
Here is a screen shot from a database posted in the Examples area of this forum.
At the top shows the relationship between the "INVOICE" table which is the data source for MainForm and the "SHIP_TO" table is the data source for a SubForm. The lower part of the screen shot shows the Data page of the SubForm dialog Properties Form. The MainForm/SubForm are linked together using the Link master fields and Link slave field properties.
Test.png
How can i update the table2 from the datas of table1?
Are wanting to duplicate the same data in fields of both tables?
In a relational database, that is a normalization violation and in most cases not recommended.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Post Reply