using form's OpenReport to open report with multiple subreports

M

MugWump

Morning, I'm still fairly new to all this stuff so bare with me :). I've
looked around and found lots of great help on this site before, but nothing
that specifically addresses the problem I seem to be having now. I'll try to
be specific - so apologies if I get a little wordy:

I have an unbound form that contains an unbound combo box and two unbound
text boxes. The user can select a name (RepID) from the combo box, enter a
start and end date into the two text boxes (DateCompleted) and click a
refresh button. All the necessary information is then displayed in 2 subforms
(subforms are bounded to two separate queries). There are times when the user
wants to print this information and so I need to generate a report from that
form.

I added a new command button and used the OpenReport method in the form and
passed a string to the report containg the RepID and specific DateCompleted
dates (taken from the stored combo and text fields). But this only seems to
work for the "main" report and doesn't affect the subreports.

Example:

The main report is bound to a query which calculates an Accuracy Score for
each DateCompleted and RepID in the database (i.e. an accuracy rating for the
work that RepID completed each day). Opening the report by itself just gives
a total Score for ALL work and lists this information for ALL RepIDs. If this
report is opened from the above mentioned form then it only displays the
information for the selected RepID during the specific DateCompleted date
range - perfect! However, the users also want to see a list of all the errors
made during that date range - and this is where the problem starts.

I have a separate query that lists the specific error information - it
contains the RepID and DateCompleted fields plus alot of other junk. So I
created a report based off this query and linked it to the Main report via
the RepID field. Then I opened the Main report via the form: The score is
calculated as expected and the errors that get listed are for that specific
RepID - only they include ALL errors regardless of DateCompleted.
The flip side: if I link the two reports based on DateCompleted and then open
it via the form I get the correct Score and it lists all the errors made
during the given date range - but it includes ALL errors regardless of the
RepID.

If I don't link the two reports at all, or link them by both RepID and
DateCompleted, then only the score displays and the subform doesn't appear at
all.

If I switch it and have the Main Report list the errors and the subreport
list the score then just the opposite happens: I get the correct error
information but the scores are either for ALL DateCompleted dates or ALL
RepIDs (or nothing at all if I link by both fields)

It seems I'm close but it's just not working. Does the OpenReport method in
the form not work with subreports? Any assistance you guys can provide would
be greatly appreciated! Thanks

-Justin
 
M

MugWump via AccessMonster.com

Nevermind, I figured it out - had to use the filter data from the from in the
underlying query for the subreports. The openReport method only seems to work
with main forms. But all is well now. Thanks anyway
 

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