Counting in Subform

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,
 
A

Arvin Meyer MVP

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.
 
A

aubrey

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,
 
A

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,
 

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