Lost Filters

  • Thread starter Thread starter M Stery
  • Start date Start date
M

M Stery

Using Access 2000 - I have a variety of reports and labels that use
the same base queries. Each is filtered by one field within the
report. On a completely random basis, and for no apparent reason,
filters are lost. Reports are called from an Open Report button on a
Switchboard. Is this an Access bug and can it be fixed? I hate to
have to bloat up this database with nearly 100 different queries to
address differences in one field's data to fix this once and for all
on my reports. I've accepted that filters sometimes disappear when you
import reports, but even after I've fixed that, the filters still
sometimes simply go away. Thanks for any advice.
 
M said:
Using Access 2000 - I have a variety of reports and labels that use
the same base queries. Each is filtered by one field within the
report. On a completely random basis, and for no apparent reason,
filters are lost. Reports are called from an Open Report button on a
Switchboard. Is this an Access bug and can it be fixed? I hate to
have to bloat up this database with nearly 100 different queries to
address differences in one field's data to fix this once and for all
on my reports. I've accepted that filters sometimes disappear when you
import reports, but even after I've fixed that, the filters still
sometimes simply go away.


I don't have an answer for the filter wierdness. After
seeing several problems of this kind, I gave up on filters
and use some other technique to the job.

In this situation, I strongly prefer to use the OpenReport
method's WhereCondition argument to filter the report. With
a little VBA code you won't even need a separate report just
to filter on a different field.

Assuming you have a button to for users to click when they
want to print a report. The code in the button's Click
event could be slightly modified to look more like:

Dim stDoc As String
Dim stWhere As String
stDos = "nameofreport"
stWhere = "somefield = somevalue"
DoCmd OpenReport stDoc, acViewPreview, , stWhere
 
Thanks - is it possible to do this on the report's On Open or On
Activate event, rather than on the switchboard's button click? I
don't think it's possible (at least I don't know how to) edit button
functions created by the Switchboard Manager. Would I use the same
code shown here? Thanks again.
 
M said:
Thanks - is it possible to do this on the report's On Open or On
Activate event, rather than on the switchboard's button click?

Trying to manipulate the filter in the report is the problem
you initially asked about. That's what we're trying to
avoid by using a more reliable approach.

I don't think it's possible (at least I don't know how to) edit button
functions created by the Switchboard Manager. Would I use the same
code shown here?

Oh boy. I think the switchboard manager is like using a
sledgehamer to open a peanut - clumsy and not flexible
enough for fine tuning. IMO, it is far easier and
definitely more versatile to create your own switchboard
like form using command buttons.

If you're stuck with the switchboard manager, then I think
the best you can do is tell it to open a form that can be
used to open the report. Creating your own form for this
purpose would be far more straightforward and easier to
customize. This way you can also have text and or combo
boxes where the user can specify the field and values they
want to use to filter the report.
 
Back
Top