Subreport filter

K

k-chan

Hi,
I'm working with Access 2003, and is having problems with setting the
filter for a subreport I have.

Here's how my report works. For each student in a class specified by
the user, it would print out a page consisting of the student's
information for the specified class (i.e. marks, homework completion
etc.), as well as a list of other classes the student is in.

I have it set up so that the subreport is the list of other classes
the student is in. What I have a problem is how to filter out the
class that was specified by the user.
[So if Student A is in math, english and chemistry class, and the user
selected to see all the chemistry students, the subreport for Student
A should only show math and english]
So what I want to add is tblStudent.class <> [Reports]![RptMainReport].
[class] as a filter/where clause.

I'm using the query builder in access to specify the record source of
the subreport. I've tried using the subreport's filter, but that
didn't work, saying it was invalid property.
I tried to add in a clause at the OnOpen event of the subreport, which
worked for the first student, but when I tried to go to the next page,
it gave me an error saying I can't change the control source when the
report had been printed.

Any ideas?
Thanks in advance.
 
M

Marshall Barton

k-chan said:
I'm working with Access 2003, and is having problems with setting the
filter for a subreport I have.

Here's how my report works. For each student in a class specified by
the user, it would print out a page consisting of the student's
information for the specified class (i.e. marks, homework completion
etc.), as well as a list of other classes the student is in.

I have it set up so that the subreport is the list of other classes
the student is in. What I have a problem is how to filter out the
class that was specified by the user.
[So if Student A is in math, english and chemistry class, and the user
selected to see all the chemistry students, the subreport for Student
A should only show math and english]
So what I want to add is tblStudent.class <> [Reports]![RptMainReport].
[class] as a filter/where clause.

I'm using the query builder in access to specify the record source of
the subreport. I've tried using the subreport's filter, but that
didn't work, saying it was invalid property.
I tried to add in a clause at the OnOpen event of the subreport, which
worked for the first student, but when I tried to go to the next page,
it gave me an error saying I can't change the control source when the
report had been printed.


The subreport's record source query should use the same
criteria that the main report uses.

If you are using a query parameter prompt for users to enter
the main report class, then, to avoid being prompted
multiple times, use an unbound form with a text box for the
parameter and a button that opens the report. In this
arrangement, the query parameter would look like:
Forms!theform.thetextbox
 

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