Subtotal in form Died With Combo Box

  • Thread starter OnTheJobLearning
  • Start date
O

OnTheJobLearning

So, I cannot do a Sum function when one of the control sources is an
expression (to pull a number from a table?)

Thanks.


You no longer have a Unit Cost field in the form if you have set the Control
Source of a Unit Cost control to this expression:
=[Wafer TypeA].Column(1)

So this expression is not valid any more because Sum cannot see a control
named Unit Cost, it can only see a field named Unit Cost:
=Sum([Quantity]*[Unit Cost])

--

Ken Snell
<MS ACCESS MVP>



OnTheJobLearning said:
The Subtotal field in the main form is:
=[Approvals Subform]![Total Approved]

The Total Approved field in the subform is:
=Sum([Quantity]*[Unit Cost])

The Unit Cost field is: (Based off Wafer TypeA combo box choice)
=[Wafer TypeA].Column(1)





Ken Snell (MVP) said:
Assuming that you're using the Sum function to calculate the subtotal,
you
must use only field names in the Sum expression -- you cannot use the
value
from a control.

Post the expression that you're using to calculate the subtotal.
 
B

boblarson

You CAN use the Sum, but you have to pass it the entire full calculation
instead of controls that have the calculations in them (as Ken Snell) noted.
--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
____________________________________
Access 2000, 2003, 2007, SQL Server 2000, Crystal Reports 10/XI, VB6
WinXP, Vista


OnTheJobLearning said:
So, I cannot do a Sum function when one of the control sources is an
expression (to pull a number from a table?)

Thanks.


You no longer have a Unit Cost field in the form if you have set the Control
Source of a Unit Cost control to this expression:
=[Wafer TypeA].Column(1)

So this expression is not valid any more because Sum cannot see a control
named Unit Cost, it can only see a field named Unit Cost:
=Sum([Quantity]*[Unit Cost])

--

Ken Snell
<MS ACCESS MVP>



OnTheJobLearning said:
The Subtotal field in the main form is:
=[Approvals Subform]![Total Approved]

The Total Approved field in the subform is:
=Sum([Quantity]*[Unit Cost])

The Unit Cost field is: (Based off Wafer TypeA combo box choice)
=[Wafer TypeA].Column(1)





Ken Snell (MVP) said:
Assuming that you're using the Sum function to calculate the subtotal,
you
must use only field names in the Sum expression -- you cannot use the
value
from a control.

Post the expression that you're using to calculate the subtotal.
--

Ken Snell
<MS ACCESS MVP>



message I have a calculated subtotal in a subform that is displayed in the main
form.
Worked well. Until, I created a combo box to select the product and
set
up
the Unit Price field to auto fill from the product choice. The line
total
calculation in the subform after the unit price works yet. I noticed,
however, that my calculated subtotal in the main form stopped working.

Is this because the unit price involved in the calculation of the line
total
is tied to the product choice in the combo box?

thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top