Filter not working in sub report

  • Thread starter Thread starter PayeDoc
  • Start date Start date
P

PayeDoc

Hello All

I have a report that has the following onOpen event:

Private Sub Report_Open(Cancel As Integer)
Me.Filter = "([nhsp ers]<>0 Or [nhsp ees]<>0 Or [added yrs pen]<>0) and
[nhsp membership]=2"
Me.FilterOn = True
End Sub

The report opens fine when opened directly, but when I use it as a sub
report I get the message:

Runtime error 2101 The setting you entered isn't valid fro this property.

.... and when I click Debug I am taken to the Me.Filter line in the above
onOpen event.
Why is this happening, and what should I do?

Hope someone can help.
Thanks in advance
Les
 
The timing of the events means that this approach doesn't work. You need to
find another way to filter the subreport instead of Report_Open.

If the filter never changes, just make a query and type the criteria in. Use
the query as the RecordSource of the report.

If you need the user to select the filter, create the query so it reads the
values from the form. For example, you might set the Criteria row under one
of the fields to:
<> [Forms].[Form1].[Text0]
 
Back
Top