Conditional Count on Text Box

  • Thread starter Thread starter Brent
  • Start date Start date
B

Brent

I have a form that I want to count the number of items in a subform that has
a invoice amount more than a payout amount field. How would I code the
control source to produce this.

The main form name is frmAssignWO-PPR and the sub form is subfrmAssignWO-PPR

The invoice total field is InvoiceTotal and the Payout field is Payout.

Any help is appreciated.

Brent
 
You don't need the name of the subform. Instead, you need the name of the
subform control that holds the subform.

=IIf([InvoiceTotal]>[Payout],
Forms!frmAssignWO-PPR.SubformControl.Form.Recordset.RecordCount,"")

The exact syntax will vary depending on where the InvoiceTotal and Payout
controls are located and where the textbox you are placing this equation in
is located. Also, Access will probably put brackets around the members of
the RecordCount expression. If it doesn't and the equation doesn't work, you
may need to add them manually.
 
Thanks.....

Brent
Wayne Morgan said:
You don't need the name of the subform. Instead, you need the name of the
subform control that holds the subform.

=IIf([InvoiceTotal]>[Payout],
Forms!frmAssignWO-PPR.SubformControl.Form.Recordset.RecordCount,"")

The exact syntax will vary depending on where the InvoiceTotal and Payout
controls are located and where the textbox you are placing this equation
in is located. Also, Access will probably put brackets around the members
of the RecordCount expression. If it doesn't and the equation doesn't
work, you may need to add them manually.

--
Wayne Morgan
MS Access MVP


Brent said:
I have a form that I want to count the number of items in a subform that
has a invoice amount more than a payout amount field. How would I code
the control source to produce this.

The main form name is frmAssignWO-PPR and the sub form is
subfrmAssignWO-PPR

The invoice total field is InvoiceTotal and the Payout field is Payout.

Any help is appreciated.

Brent
 
Back
Top