How to automatically total rows in a subform

Creating and using forms
Post Reply
Ron19855
Posts: 10
Joined: Thu Dec 27, 2018 11:25 pm

How to automatically total rows in a subform

Post by Ron19855 »

Hello,

I'm looking to multiply quantity by price and display the value in a field called subtotal. I've included an image that shows where I currently stand. The main form is my Order table, while the subform below is pulling from my OrderDetails table. I also have a product table which is where productPrice is stored. Is there a way to multiply productPrice from the product tbl and quantity from the OrderDetails tbl and then display them at the end of each row of the subform? I know in Access there is a function called calculated control which will let you accomplish this but I haven't been able to find similar functionality in Base. I've tried using a query to multiply the two, but I don't know if it's possible to display the query result for each product that belongs to a particular order; I instead was only able to create a new subform that I had to scroll through and didn't dynamically pick out the corresponding values for the order. One other idea I had was to create a query that contained the orderDetails fields plus the subtotal calculation and use that for the subform, but it doesn't appear that you can display queries as a table within a form. I feel like this has to be a common for anyone how wants to create an invoice like this, but I haven't been able to find an answer anywhere. Any assistance will be greatly appreciated. P.S. In the image included, productPrice and subtotal are fields from my query that I tried dragging and dropping onto the subform table, but obviously, they do not display any data. The query is able to display correct data when entered as formatted fields so I know the query is functioning.
Attachments
Screencap of form
Screencap of form
OpenOffice 4.1.6 - Windows 7 Ultimate
UnklDonald418
Volunteer
Posts: 1544
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: How to automatically total rows in a subform

Post by UnklDonald418 »

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