filter

  • Thread starter Thread starter maggie
  • Start date Start date
M

maggie

I have a form in which the users are allowed to filter by
a certain field. When they print the report, I would
like that filter to carry over to the report. And if
they don't use a filter, then the report should print
all. For example, if they filter just grade 3, then the
report should just print grade 3. If the next time they
filter grade 4, then the report should just print grade
4. Thanks in advance!
 
maggie said:
I have a form in which the users are allowed to filter by
a certain field. When they print the report, I would
like that filter to carry over to the report. And if
they don't use a filter, then the report should print
all. For example, if they filter just grade 3, then the
report should just print grade 3. If the next time they
filter grade 4, then the report should just print grade
4.

You can use the OpenReport method's WhereCondition
argument to filter the report.

You didn't say how you're filtering the form, but if it's in
the form's Filter property, you might do this:

If Me.FilterOn = True Then
DoCmd.OpenReport "reportname", acViewProview, _
WhereCondition:= Me.Filter
Else
DoCmd.OpenReport "reportname", acViewProview
End If
 
Back
Top