Counting in Subform

  • Thread starter Thread starter aubrey
  • Start date Start date
A

aubrey

Good afternoon all,

I have a Mainform and a Subform, which is displayed in datasheet view. On my
Subform I have a field that is a "Yes/No" checkbox. I want to populate a
field in my main Mainform based on have many records on the Subform are
checked.

If anyone can point me in the right direction that would be great.

Aubrey,
 
1. Add a footer to the subform.
2. Add a textbox named txtCount to that footer
3. Make its Controlsource:

= Sum([chkNameOfCheckboxControl])*-1

4. Add a textbox to the mainform
5. Set its Controlsource to:

=[NameOfSubformControl].Form![txtCount]

The value of True in a checkbox is -1. By adding them and multiplying the
sum by -1 you will get a positive count.
 
Works great, thank you very much.

Arvin Meyer MVP said:
1. Add a footer to the subform.
2. Add a textbox named txtCount to that footer
3. Make its Controlsource:

= Sum([chkNameOfCheckboxControl])*-1

4. Add a textbox to the mainform
5. Set its Controlsource to:

=[NameOfSubformControl].Form![txtCount]

The value of True in a checkbox is -1. By adding them and multiplying the
sum by -1 you will get a positive count.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


aubrey said:
Good afternoon all,

I have a Mainform and a Subform, which is displayed in datasheet view. On
my
Subform I have a field that is a "Yes/No" checkbox. I want to populate a
field in my main Mainform based on have many records on the Subform are
checked.

If anyone can point me in the right direction that would be great.

Aubrey,
 
Hi,

the below process works, in tems of the tally, but now that I have changed
the Control Source to =[NameOfSubformControl].Form![txtCount], the tally does
not populate in my table.

any thought on how to get that info back to my table

Thanks

Arvin Meyer MVP said:
1. Add a footer to the subform.
2. Add a textbox named txtCount to that footer
3. Make its Controlsource:

= Sum([chkNameOfCheckboxControl])*-1

4. Add a textbox to the mainform
5. Set its Controlsource to:

=[NameOfSubformControl].Form![txtCount]

The value of True in a checkbox is -1. By adding them and multiplying the
sum by -1 you will get a positive count.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


aubrey said:
Good afternoon all,

I have a Mainform and a Subform, which is displayed in datasheet view. On
my
Subform I have a field that is a "Yes/No" checkbox. I want to populate a
field in my main Mainform based on have many records on the Subform are
checked.

If anyone can point me in the right direction that would be great.

Aubrey,
 
Back
Top