[Solved] How show a many-to-many relation in a form?

Discuss the database features

[Solved] How show a many-to-many relation in a form?

Postby Bazsl1 » Wed Mar 16, 2016 2:37 am

Assume I have a many-to-many relationship between table A and table B that is implemented using a linking table L.
1) The linking table must have a primary key that consists of two columns. Can I define a multi-column primary key in Base? If not, can I create the linking table using DDL and create a muli-column primary key?

2) Is it possible to display the one-to-many relationship from table A to table B in a form? I can't see how to include the one-to-many link from A to L and the one-to-one link from L to B in a form since forms only support one level of sub-form.

Last edited by Bazsl1 on Thu Mar 17, 2016 12:36 am, edited 1 time in total.
OpenOffice 4.1.2 on Windows 10 Pro
Posts: 29
Joined: Mon Aug 03, 2015 8:07 pm

Re: How show a many-to-many relation in a form?

Postby Villeroy » Wed Mar 16, 2016 3:01 am

[Example] Relations reflected by list boxes in forms
The recipe is:
A in the main form (either way as grid or details).
L in the subform linked through the common A.IDs implemented as a grid of B.IDs. No need to show the A.ID.
Implement the grid's displayed B.IDs as a column of list boxes showing SELECT B.string, B.ID FROM B ORDER BY B.string

When editing the related data, you select B.items into the L.grid which belong to the current A.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.4
User avatar
Posts: 28647
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Return to Base

Who is online

Users browsing this forum: No registered users and 3 guests