[Solved] Numerical field-Subform link

Discuss the database features
Post Reply
PMarcotte
Posts: 8
Joined: Wed Jan 25, 2017 3:53 am

[Solved] Numerical field-Subform link

Post by PMarcotte »

Hi everyone,

I inserted a numerical field in a form to show the total for a given invoice, but the field does not follow the form, I have to click inside it and then navigate the invoices (F_Facture, SommeFacture). I tried to copy the methods and SQL instructions but i'm obiously missing something.

On a very related note, sometimes I want to just show info in a dropdown ListBox, but the input gets repeated to the table with a new ID. What am I doing wrong?

I feel totally incompetent, and I'm usually a pretty smart guy. :knock: :oops:

Finally, I don't think I thanked eremmel for the last time he helped me, so a big thank you to him!

Cheers
Attachments
004.odb
(91.03 KiB) Downloaded 169 times
Last edited by PMarcotte on Fri Nov 03, 2017 4:13 pm, edited 1 time in total.
OpenOffice 4.1.3 on Windows 7
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Numerical field-Subform link

Post by Villeroy »

Data properties of listbox:
Data Field = empty
Bound Field = empty
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
UnklDonald418
Volunteer
Posts: 1548
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Numerical field-Subform link

Post by UnklDonald418 »

To get your total calculation on the form document F_Facture to follow the invoice you need to move the subform “Formulaire 1” to be a subform of ”SousFormDétail”.
The query supplying data to “Formulaire 1” should be changed to

Code: Select all

SELECT SUM( "TFD"."Qte" * "TB"."Prix" ) AS "SommeFacture", "TFD"."ID_Facture" FROM "T_FactureDetail" AS "TFD", "T_Facture" AS "TF", "T_Bijou" AS "TB" WHERE "TFD"."ID_Facture" = "TF"."ID" AND "TB"."ID" = "TFD"."ID_Bijou" GROUP BY "TFD"."ID_Facture";
And finally set both the Link Master fields and Link Slave fields properties to “ID_Facture”
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
PMarcotte
Posts: 8
Joined: Wed Jan 25, 2017 3:53 am

Re: Numerical field-Subform link

Post by PMarcotte »

All right, now I understand how it works. If I want to show an aggregate of a table, or any content of a form, I need to insert a SubForm within that form and reference it in my ListBox (or TextBox, Currency, etc.)

Thank you very much. Every new thing is a small victory.
OpenOffice 4.1.3 on Windows 7
Post Reply