How to filter Report Information?

  • Thread starter Thread starter Bayou BoB
  • Start date Start date
B

Bayou BoB

Ohhh...sorry, I could have included this in the last post, but I
remembered as I was hitting send.

I have an attendance tracking DB, whereby we track all of our
patient's attendance in a given day-program activity. As it stands
now, I am able to generate reports by client that allow me to see just
how many hours in total they have spent in day programs. However,
there are often about 30+ entries per patient, per month. So really, a
detailed report isn't printed unless there are extraordinary
circumstances, or unless someone's summary report looks like it has
fishy numbers, and then we'll print out a detailed version to have a
real close look at each day's events and the time spent at each. As
you can imagine, over the course of a year, there would be a TON of
detailed entries per patient.

What I want to do is filter the records so that i can print a month's
worth of entries, a 3 month period of entries, and a year's amount of
entries. I have the report style already made.... but I'm wondering
two things...

1) Do I need to copy that report 3 times and name each one slightly
differently in order to filter the date 3 different ways? Or can
somebody elaborate on how to use one copy of the report to filter in
different ways to get differing amounts of date.

2) How do I use the report properties filter possibilities to create a
filter to limit the results to the 3 ways I have listed above, to
limit data? If there is a way to write the filter to accomodate each
of those, I'd be much appreciative of your help in how to structure
and write the filter.

Many thanks!

Kevin
 
Bayou said:
Ohhh...sorry, I could have included this in the last post, but I
remembered as I was hitting send.

No, it's better this way. Separate questions in separate
threads and all that.

I have an attendance tracking DB, whereby we track all of our
patient's attendance in a given day-program activity. As it stands
now, I am able to generate reports by client that allow me to see just
how many hours in total they have spent in day programs. However,
there are often about 30+ entries per patient, per month. So really, a
detailed report isn't printed unless there are extraordinary
circumstances, or unless someone's summary report looks like it has
fishy numbers, and then we'll print out a detailed version to have a
real close look at each day's events and the time spent at each. As
you can imagine, over the course of a year, there would be a TON of
detailed entries per patient.

What I want to do is filter the records so that i can print a month's
worth of entries, a 3 month period of entries, and a year's amount of
entries. I have the report style already made.... but I'm wondering
two things...

1) Do I need to copy that report 3 times and name each one slightly
differently in order to filter the date 3 different ways? Or can
somebody elaborate on how to use one copy of the report to filter in
different ways to get differing amounts of date.

Absolutely not!

2) How do I use the report properties filter possibilities to create a
filter to limit the results to the 3 ways I have listed above, to
limit data? If there is a way to write the filter to accomodate each
of those, I'd be much appreciative of your help in how to structure
and write the filter.

The best way it to use a form where the users can specify
what they want in the report. In this case you could use an
Option Group with three radio buttons, one for each of the
different periods. You should also have a Print Report
button for the users to click when they're ready to print
the report.

The button's Click event procedure can then use the
OpenReport method's WhereCondition argument to filter the
report. Modify the button wizard's generated code to look
more like this:

Dim stDoc As String
Dim stWhere As String

stDoc = "nameofthe report"
Select Case optiongroup
Case 1 ' Current month
stWhere = "Month([datefield]) = " & Month(Date) _
& " And Year([datefield]) = " & Year(Date)
Case 2 'Current quarter
stWhere = "DatePart("q", [datefield]) = " _
& DatePart("q",Date) _
& " And Year([datefield]) = " & Year(Date)
Case 3 'Current year
stWhere = "Year([datefield]) = " & Year(Date)
End Select

DoCmd.OpenReport stDoc, acViewPreview, , stWhere
 
Back
Top