Sub-Report: Setting a Filter or Recodsource

G

Guest

How can I set a Filter or change a Recordsource in a sub-report. It doesn't
let me do it in the sub-reports Open sub, and I can't get it to work from the
parent report either. I've tried different variations of these statements:

Me.rpt_AI_Detail.Report.Filter = "AssignedToID = 3377"
Me.rpt_AI_Detail.Report.Recordsource = "Select * FROM tblAI WHERE " & xFilter

The errors I get in the parent report basically say "Invalid reference to
the property". In the subreport it either says I can't change the
recordsource because printing has begun, or the filter is not updateable.

The subreport is linked to the parent by an ID field, but there are 6
possible OpenArgs to the parent that further define what the subreport shows.

Any suggestions would be greatly appreciated. Thanks...

Dave
 
G

Guest

Just to clarify - I need to set this dynamically. I do know how to set the
Filter and Recordsource normally.

Also, if I use Me.Filter="AssignedToID = 3377" in the subreport's Open sub,
it works fine if I preview the subreport by itself. But when I preview the
parent report I get the error: "Runtime Error 2101: The setting you entered
isn't valid for this property."

Dave
 
M

Marshall Barton

SlydeRule said:
How can I set a Filter or change a Recordsource in a sub-report. It doesn't
let me do it in the sub-reports Open sub, and I can't get it to work from the
parent report either. I've tried different variations of these statements:

Me.rpt_AI_Detail.Report.Filter = "AssignedToID = 3377"
Me.rpt_AI_Detail.Report.Recordsource = "Select * FROM tblAI WHERE " & xFilter

The errors I get in the parent report basically say "Invalid reference to
the property". In the subreport it either says I can't change the
recordsource because printing has begun, or the filter is not updateable.

The subreport is linked to the parent by an ID field, but there are 6
possible OpenArgs to the parent that further define what the subreport shows.


I won't use the Filter property so I can't explain anything
useful about that. You can set the RecordSource property in
a subreport's Open event, but only the first time it is
called.

For a simple filter value such you've posted here, I suggest
that you place the value in a main report text box and use
that in the LinkMaster property.
 

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