Ask Your Question
0

make a double relationship between two tables

asked 2015-12-15 21:58:20 +0200

argonaut gravatar image

In a database I have a table with members and a table with whishes. A whish is placed by one member and executed by another member. In a grid I want to see both the names of the member who places a whish and the member who execute the whish. In a earlier question I was advised to make a join. This works fine for one relation (the member who places the whish). I cannot connect the name-info of the executing member from the member table in a querie to the grid.

edit retag flag offensive close merge delete

Comments

I just solved my own problem by making a new querie as a copy of the members table and making a new relationship from the whishes table to the new querie membertable. Hope I did it right, for now it works :)

argonaut gravatar imageargonaut ( 2015-12-15 22:29:49 +0200 )edit

3 Answers

Sort by » oldest newest most voted
1

answered 2015-12-17 15:10:43 +0200

pierre-yves samyn gravatar image

updated 2015-12-22 14:58:17 +0200

Hi

It is not always necessary to create a new query. We can insert the same table multiple times in a query. It will be referenced by a table alias (Members_1 in the screenshot) to distinguish it as shown in the screenshot below (see Query1 in Wishes.odb).

image description

Moreover, in a data grid, you can use a drop-down list to join as in the attached example (see Members form).

[EDIT]

It is possible to use the concatenation operator || in the Sql source of the listbox to display more columns (see Wishes form in WishesPys.odb.

Use a DataGrid requires a more complex macro programming...

Regards

edit flag offensive delete link more
0

answered 2015-12-18 22:36:56 +0200

argonaut gravatar image

Thank you very much for your answer. I realy liked the way you included an example.` I still see queries and aliases are blanc ( ? ) but it gives me lots to think about.

To enter a whish I would like to use a list (from members table) for both PlacedBy as ExecutedBy. I tried a list (with and without input) but that only gives one field. Is there a way to make a small grid (three fields) to choose the right persons ?

I included my test odb for your information. (translation: members=leden, whishes=wensen) There are more catagories of whishes (garden, administration, transport, diy etc) C:\fakepath\wbl1.odb

Tks, Hans

edit flag offensive delete link more
0

answered 2015-12-23 16:25:31 +0200

peterwt gravatar image

In your EDIT of the Question you asked about concatenation of columns in a list box.

Yes you can do this. If we have a Table Contacts with IDContact as an integer Primary Field and FirstName and Surname as Text fields. Then in the List Box Properties Bound field set to 1 and the List Box List content set to:-

SELECT "FirstName" || ' - ' || "Surname", "IDContact" FROM "Contacts"

The List Box will show FirstName - Surname with the bound field IDContact.

edit flag offensive delete link more

Comments

@peterwt

I do not understand why this answer? I did not ask the question, I gave the answer with an example file

Regards.

pierre-yves samyn gravatar imagepierre-yves samyn ( 2015-12-24 07:33:17 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-12-15 21:58:20 +0200

Seen: 451 times

Last updated: Dec 23 '15