total of subform in mainform (1 Viewer)

dark11984

Registered User.
Local time
Today, 12:13
Joined
Mar 3, 2008
Messages
129
Hi,
I am trying to sum the total of a column (linetotal) on a subform and have the result appear in a text box(total) on my mainform. The control source of [linetotal] is [qty]*[unitpr].

I have tried a few different ways and still can't get the result i want. I can get the [total] to = [unitpr] by itself but not [linetotal].

Can someone please help?
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 03:13
Joined
Sep 12, 2006
Messages
15,634
put linetotal: = qty * price IN the query

now you can just have a textbox in the footer of the subform

mytotal - control source =sum(linetotal)

and you can refer to this in the mainform

subdetails!mytotal
 

dark11984

Registered User.
Local time
Today, 12:13
Joined
Mar 3, 2008
Messages
129
The subform doesn't have a query. It's record source is a table. Is there any other way?
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 03:13
Joined
Sep 12, 2006
Messages
15,634
you are better using a query based on the table - that way you can sort it in a sensible order, and add things like this

it only takes a minute to change from a table to a query, as none of your textboxes etc need to change

just create the query, and change the forms record source
 

Users who are viewing this thread

Top Bottom