Query/Report problem

K

Kim T

I have a form that ask questions 1-15 there is an option box with Met=1 Not
Met=2 N/A=3 as the value.
I want to run a report that will group by the value of each 1-2-3

I dont have a total field yet I not sure how I need to code this I would
like the following:
Met=total #
Not Met =total #
N/A=total #

please help
 
K

Ken Sheridan

If you want all the totals together rather than in separate footers add three
text boxes to the report, e.g. in the report footer with ControlSource
properties of:

= "Met = " & Sum(IIf([YourField] = 1,1,0))

= "Not Met = " & Sum(IIf([YourField] = 2,1,0))

= "N/A = " & Sum(IIf([YourField] = 3,1,0))

where YourField is the name of the field to which the option group is bound.
The IIf function will return 1 or 0 depending on the value of the field, so
by summing the 1s the result is a count of the records with that value in the
field.

Ken Sheridan
Stafford, England
 
K

KARL DEWEY

SELECT Sum(IIF([OptionGroupField] = 1, 1, 0)) AS [Met],
Sum(IIF([OptionGroupField] = 2, 1, 0)) AS [Not Met],
Sum(IIF([OptionGroupField] = 3, 1, 0)) AS [N/A]
FROM [YourTableName];
 

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