Issue with SUM on continuous form (1 Viewer)

MarRyb

New member
Local time
Today, 11:30
Joined
Dec 2, 2015
Messages
10
Hi there,

I'm new in MS Access and I know the golden rule about searching for an answer prior creating a post, but I could not find anything helpful.

My problem is as follows.

I have 2 tables ComponentsT (with fields - ComponentID, comCode, comName and comPrice) and ComponentListT (with fields – ComListID, ComponentID and comlistQty), with two forms ComponentsF (Single Form) and ComponentsListF (Continuous Form).

My goal is to have list of components on that continuous form where I want to calculate comPrice*comlistQty in unbound textbox (txtTotalCompPrice) for each row. This works, I am using =[txtComponentPrice]*[comlistQty] (where txtComponentPrice is textbox taking its value from combobox – contro source is set to =[ComponentID].[column](3)).

However, when I try to calculate SUM in the cont. form footer for the textbox mentioned above I will get #Error. I am using this =Sum([txtTotalCompPrice]).

Attached is my DB file (MS Access 2013).

Thanks in advance for any help you can provide,
Martin
 

Attachments

  • DB R_0_2_0.zip
    53.5 KB · Views: 139

Ranman256

Well-known member
Local time
Yesterday, 21:30
Joined
Apr 9, 2015
Messages
4,339
dont sum the text box name, sum the field name.
 

sneuberg

AWF VIP
Local time
Yesterday, 18:30
Joined
Oct 17, 2014
Messages
3,506
dont sum the text box name, sum the field name.

That's part of the problem I found that

=Sum([ComponentListT]![comlistQty])

works for the sum of the quantity, but for the other sum you will need to make the record source of the form a query which joins the two table so that you have a field there to use in the sum. Your sum will have to be the sum of the products something like:

=Sum([ComponentsT]![comPrice]*[ComponentListT]![comlistQty])
 

MarRyb

New member
Local time
Today, 11:30
Joined
Dec 2, 2015
Messages
10
Thank you very much for this. It works now.
 
Local time
Today, 11:00
Joined
Jul 13, 2019
Messages
1
Hi,

Sorry if this is too late for this reply however some new users with the same question may find it useful, best is to use DSUM when you are in a form.



Hi there,

I'm new in MS Access and I know the golden rule about searching for an answer prior creating a post, but I could not find anything helpful.

My problem is as follows.

I have 2 tables ComponentsT (with fields - ComponentID, comCode, comName and comPrice) and ComponentListT (with fields – ComListID, ComponentID and comlistQty), with two forms ComponentsF (Single Form) and ComponentsListF (Continuous Form).

My goal is to have list of components on that continuous form where I want to calculate comPrice*comlistQty in unbound textbox (txtTotalCompPrice) for each row. This works, I am using =[txtComponentPrice]*[comlistQty] (where txtComponentPrice is textbox taking its value from combobox – contro source is set to =[ComponentID].[column](3)).

However, when I try to calculate SUM in the cont. form footer for the textbox mentioned above I will get #Error. I am using this =Sum([txtTotalCompPrice]).

Attached is my DB file (MS Access 2013).

Thanks in advance for any help you can provide,
Martin
 

Users who are viewing this thread

Top Bottom