2 subforms, 1 subtotal, 1 grandtotal (1 Viewer)

willsnake

Registered User.
Local time
Today, 07:02
Joined
Dec 3, 2018
Messages
52
Good day experts,

Here I am again seeking help for the access database I am trying to create.

Attached is my main form, what I wish is that SUBTOTAL will be displayed in the 1st subform (LOT) from the total of 2nd subform (LOT DETAILS). Then from the total in 1st subform, a grand total will be displayed in the main form.

Hope this is possible, I have been searching but cannot find any solutions. I can only find a grand total from single subform...
 

Attachments

  • accesswill.jpg
    accesswill.jpg
    83 KB · Views: 85

June7

AWF VIP
Local time
Yesterday, 15:02
Joined
Mar 9, 2014
Messages
5,463
A form doesn't really have the properties to do what you want (reports do). Likely will have to use DSum() domain aggregate function.

What method are you using to synchronize the two subforms?
 
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 07:02
Joined
May 7, 2009
Messages
19,227
you need to create a Query for your first subform that will Sum the the total of the Lot Detail:
Code:
select [Lot Number], [Particular], (Select Sum(T1.[Quantity]*T1.[Cost]) From [Lot Detail] As T1 Where T1.[Lot Number]=[Main Lot].[Lot Number]) As [SubTotal] From [Lot Main];
[Lot Main] is the table in subform1.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 07:02
Joined
May 7, 2009
Messages
19,227
if the resulting Recordset is Not Updatable the
use DSum():
Code:
select [Lot Number], [Particular], 
DSum("[Quantity]*[Cost]", "[Lot Detail]", "[Lot Number]='" & [Lot Number] & "'") As [SubTotal] 
From [Lot Main];
 

willsnake

Registered User.
Local time
Today, 07:02
Joined
Dec 3, 2018
Messages
52
A form doesn't really have the properties to do what you want (reports do). Likely will have to use DSum() domain aggregate function.

What method are you using to synchronize the two subforms?

I just did the form wizard, and include the fields from 3 different tables, then access just combine it in 1 form...
 

willsnake

Registered User.
Local time
Today, 07:02
Joined
Dec 3, 2018
Messages
52
you need to create a Query for your first subform that will Sum the the total of the Lot Detail:
Code:
select [Lot Number], [Particular], (Select Sum(T1.[Quantity]*T1.[Cost]) From [Lot Detail] As T1 Where T1.[Lot Number]=[Main Lot].[Lot Number]) As [SubTotal] From [Lot Main];
[Lot Main] is the table in subform1.

Thank you for the reply. But I can't seem to find how to do this...

Sorry for my ignorance...
 

June7

AWF VIP
Local time
Yesterday, 15:02
Joined
Mar 9, 2014
Messages
5,463
arnel is suggesting you set the form RecordSource to a query that uses DSum(). Did you try it?
 

willsnake

Registered User.
Local time
Today, 07:02
Joined
Dec 3, 2018
Messages
52
I have been searching in web on how, but I cant seem to find it...

So sorry but I am still new to Access..
 

willsnake

Registered User.
Local time
Today, 07:02
Joined
Dec 3, 2018
Messages
52
May I ask guidance on how to apply what is advised?

Thank you...
 

June7

AWF VIP
Local time
Yesterday, 15:02
Joined
Mar 9, 2014
Messages
5,463
You don't know how to set a form RecordSource property?

Suggest you provide db for analysis, follow instructions at bottom of my post.
 

willsnake

Registered User.
Local time
Today, 07:02
Joined
Dec 3, 2018
Messages
52
Good day,

Thank you very much to helping me masters...

This thread is now solved and closed...
 

Users who are viewing this thread

Top Bottom