AutoReport grayed out after filter is applied

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

Guest

Hello;
I frequently filter by form in my Access Database, or use "Advanced Filter".
Once the filter have returned my set of records, I'd like to print them, by
using the AutoReport feature; however, it is unavailable (grayed out).

Is there are way around this, or do I need to filter in a different manner?

Any help would be appreciated. Thanks.
 
You can't use an autoreport in this context. I'd suggest that you create a
report based on the form's underlying table or query; you can do this by
creating and saving an autoreport, or for a better standard of presentation
use the report wizard, or design your own report.

You can then add a button (or two buttons, one to preview , one to print if
you wish) to your form to open the report filtered to the form's Filter
property if the form is filtered, unfiltered if not. The code for the Click
event procedure of a button to open the form in Print Preview would be like
this:

Dim strCriteria As String

If Me.FilterOn Then
strCriteria = Me.Filter
End If

DoCmd.OpenReport "YourReportName", _
View:=acViewPreview, _
WhereCondition:=strCriteria

When using the built in filtering facilities, however, you should be aware
that if you filter on a value in a control such as a combo box which looks up
a value from another table then the Filter property includes lookup in the
string expression. In the report therefore you should reproduce the controls
on the form, using a combo box to show data from another table in the same
way as the form does (you can just copy and paste the combo box form the form
and paste it into the report design, then resize it etc as necessary). That
way any lookup in the form's Filter property will be understood by the
report. The combo box will print in the report just like a text box, so
visually its not a problem.
 
Thanks, Ken; you're the man! I'll try this. (When I searched HELP for
filters, it indicated I could use AutoReport. I have my own reports I use,
but never tried using them in conjunction with a filter.

I appreciate your guidance.

Patti
 
Back
Top