Calculations on Option Group

B

btcovey

What I'm trying to do seems like it should be easy, but I've been banging my
head against the wall for 2 days now and still can't figure it out.

I have an option group with 6 selections, stored as 1-6. I want to run a
summary function on these within date parameters and display a separate count
for each of the 6 options. I've tried executing this with a SQL query, a
nested subquery, using an Iif statement on a calcuated control in the form.
Nothing has worked yet.

Does anyone have any suggestions? Any help will be greatly appreciated.
 
D

Daryl S

You can run a sql query to get your results. Use totals and group by the
field that is bound to the option group, and count for the primary key field.
The SQL would look something like this:

SELECT OptGpFld, Count(PKField)
FROM YourTableOrQuery
GROUP BY OptGpFld;
 
K

KARL DEWEY

If you want horizontal display then try this --

SELECT Sum(IIF([OptGpFld] = 1,1,0)) AS Something_1, Sum(IIF([OptGpFld] =
2,1,0)) AS Something_2, Sum(IIF([OptGpFld] = 3,1,0)) AS Something_3,
Sum(IIF([OptGpFld] = 4,1,0)) AS Something_4, Sum(IIF([OptGpFld] = 5,1,0)) AS
Something_5, Sum(IIF([OptGpFld] = 6,1,0)) AS Something_6
FROM YourTableOrQuery;
 

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