count and display YES results from subform to parent form

  • Thread starter ghostman via AccessMonster.com
  • Start date
G

ghostman via AccessMonster.com

i have a field NoShow (YES/NO field) on my subform with 3 records, 2 were
marked YES..

how can count this YES answers and display it on my parent form?

thanks...
 
N

NevilleT

Hi

A couple of ways but the easist is to put a field in your query Something
like YesCount: Iif(NoShow= True, 1, 0). You can then put in a text box that
gives a total.
=Sum(NoShow)

Neville Turbit
www.projectperfect.com.au
 
D

Dale_Fye via AccessMonster.com

One way to handle this would be to add a hidden, unbound textbox
(txt_SumNoShow) to the footer of the subform. Set it's control Source to: =
Sum(Abs([NoShow]))

Then, on your main form, set the control source for the textbox where you
want to display this number to: = me.SubformControlName.form.txt_SumNoShow

Another way to do it would be to use the DSum( ) domain function. Set the
Control source of the textbox on the main form to something like:

= ABS(DSUM("NoShow", "yourTable", "[SomeID] = " & me.ID))

the DSUM function requires a field name, a table name, and accepts an
optional criteria string. In this case, the criteria string would be include
the name of the field that the form and subform are linked by and the value
of that field from the main form.

HTH
Dale
 
G

ghostman via AccessMonster.com

thanks for the response...it worked but i have to remove "me" from the code:

= SubformControlName.form.txt_SumNoShow

and it works!
Thank you very much!



Dale_Fye said:
One way to handle this would be to add a hidden, unbound textbox
(txt_SumNoShow) to the footer of the subform. Set it's control Source to: =
Sum(Abs([NoShow]))

Then, on your main form, set the control source for the textbox where you
want to display this number to: = me.SubformControlName.form.txt_SumNoShow

Another way to do it would be to use the DSum( ) domain function. Set the
Control source of the textbox on the main form to something like:

= ABS(DSUM("NoShow", "yourTable", "[SomeID] = " & me.ID))

the DSUM function requires a field name, a table name, and accepts an
optional criteria string. In this case, the criteria string would be include
the name of the field that the form and subform are linked by and the value
of that field from the main form.

HTH
Dale
i have a field NoShow (YES/NO field) on my subform with 3 records, 2 were
marked YES..

how can count this YES answers and display it on my parent form?

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