summing 2 different totals in a continuous form

F

fishqqq

I have a continuous form that has the following fields

[qty] = number field
[LockHazStatus] = text field

the idea is the user will input the total pcs of a shipment in the
[qty] field and via a combo box enter if these goods are hazardous or
non hazardous. The combo box will then update the field
[LockHazStatus] accordingly

So a particular shipment could have :
3 NonHaz (pieces)
another 3 NonHaz (pieces

2 Haz (pieces)
and another 3 Haz (pieces)

on the form footer i would like to sum the total pcs of the two types
if shipments

[Text119] = the sum of the non haz pcs - this should show "6"
[Text141] = the sum of the haz pcs - this should show "5"

Can someone tell me how to format [Text119] & [Text141] to add up all
the haz and non hazmat pcs on this continuous form.

thank you
 
M

Marshall Barton

I have a continuous form that has the following fields

[qty] = number field
[LockHazStatus] = text field

the idea is the user will input the total pcs of a shipment in the
[qty] field and via a combo box enter if these goods are hazardous or
non hazardous. The combo box will then update the field
[LockHazStatus] accordingly

So a particular shipment could have :
3 NonHaz (pieces)
another 3 NonHaz (pieces

2 Haz (pieces)
and another 3 Haz (pieces)

on the form footer i would like to sum the total pcs of the two types
if shipments

[Text119] = the sum of the non haz pcs - this should show "6"
[Text141] = the sum of the haz pcs - this should show "5"

Can someone tell me how to format [Text119] & [Text141] to add up all
the haz and non hazmat pcs on this continuous form.

For Text119, use:
=Sum(IIf([name of hax status text field] = "Haz", 0,
Qty))

For Text141, use:
=Sum(IIf([name of hax status text field] = "Non Haz",
Qty, 0))

Note that you must use the name of hax status text field
from the table, not the name of the control that display the
field.

Also, be aware the the total will not change until you do
something that saves an edited or new record.
 
F

fishqqq

I have a continuous form that has the following fields
[qty] = number field
[LockHazStatus] = text field
the idea is the user will input the total pcs of a shipment in the
[qty] field and via a combo box enter if these goods are hazardous or
non hazardous. The combo box will then update the field
[LockHazStatus] accordingly
So a particular shipment could have :
3 NonHaz (pieces)
another 3 NonHaz (pieces
2 Haz (pieces)
and another 3 Haz (pieces)
on the form footer i would like to sum the total pcs of the two types
if shipments
[Text119] = the sum of the non haz pcs - this should show "6"
[Text141] = the sum of the haz pcs - this should show "5"
Can someone tell me how to format [Text119] & [Text141] to add up all
the haz and non hazmat pcs on this continuous form.

For Text119, use:
   =Sum(IIf([name of hax status text field] = "Haz", 0,
Qty))

For Text141, use:
   =Sum(IIf([name of hax status text field] = "Non Haz",
Qty, 0))

Note that you must use the name of hax status text field
from the table, not the name of the control that display the
field.

Also, be aware the the total will not change until you do
something that saves an edited or new record.


thank you Marsh,
this works perfectly
 

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