Count months

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a column of data on a report representing months like this: 1, 2, 3, 3, 4, 4, 4, 5, 5, 6, 8. I need to count the number of months on this column, which should be 7. What function can I use to get this? Count function would give me 11 so it does not work

Thanks
 
I assume you have a field in your report's record source that contains the
values of 1 - 12. You might not have all the different values and want the
range from the min to the max. Try this expression in a group or report
header or footer:
=Max([YourField]) - Min([YourField])

--
Duane Hookom
MS Access MVP


gd said:
I have a column of data on a report representing months like this: 1, 2,
3, 3, 4, 4, 4, 5, 5, 6, 8. I need to count the number of months on this
column, which should be 7. What function can I use to get this? Count
function would give me 11 so it does not work.
 
That does not work. It is true the value range is from 1 to 12. What I need is to find out which month are in the values. For example, if I have values like 2, 2, 3, 3, 11, 11. Max-Min=11-2=9, but there are only three months in these values, so my question is how to get the number of months(which is 3 in this case).
 
Then create a totals query that groups by the month. Create another query
based on this query that counts the number of records.
Another method since this is a report is to group by month. Show the month
header and add a tet box:
Name: txtMthCount
Control Source: =1
Running Sum: Over All

Then add a text box in the report footer:
Control Source: =txtMthCount

--
Duane Hookom
MS Access MVP


gd said:
That does not work. It is true the value range is from 1 to 12. What I
need is to find out which month are in the values. For example, if I have
values like 2, 2, 3, 3, 11, 11. Max-Min=11-2=9, but there are only three
months in these values, so my question is how to get the number of
months(which is 3 in this case).
 
Back
Top