filter

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!
 
M

Marshall Barton

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
 

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