A macro to do the open several reports to print

  • Thread starter Thread starter forest8
  • Start date Start date
F

forest8

Hi there

I have six reports that comprise a survey. At the moment, when I look at my
report, I see all my records, How do I isolate it so that only one student
results appear in my report.

The next step is to print out the results of the survey for a single
respondent.

I have read that I can use OpenReport to print a single record but what I
would like to happen is the following

OpenReport.Section1
Print a single record for section1 for StudentID
OpenReport.Section2
Print a single record for section2 for StudentID
OpenReport.Section3
Print a single record for section3 for StudentID
OpenReport.Section4
Print a single record for section4 for StudentID

Unfortunately I can't even print out a single report for a single student.

I hope this makes sense.

Any help is greatly appreciated.
Thank you for
 
Forest,

There are 2 approaches that you could take here...

1. Use a Criteria in the queries that the reports are based on, to restrict
the data printed to the particular student.

2. Use the 'Where Condition' argument of the OpenReport actions in your
macro, to restrict the data printed to the particular student.

Now, how do we know which student you want it to be restricted to? Is this
something the user will select or enter on a form, in order to specify the
student for the reports?
 
Forest,

Ok, that's good. So you can refer to that in either of the two approaches I
mentioned. For example, you can put this in the Criteria of the StudentID
field of the queries that the reports are based on:
[Forms]![NameOfParentForm]![NameOfSubform]![StudentID]

Or, to use the other approach, if the button to print the report is on the
subform itself, this would go in the Where Condition argument of the
OpenReport action in the macro:
="[StudentID]=" & [StudentID]
 
On my website (www.rogersaccesslibrary.com), is a small Access database
sample called "PrintOneLabel.mdb" which illustrates how to do this. Don't be
misled by the name. The same process works for printing one record
(displayed on a form) on any kind of report. The sample actually shows 3
different ways to achieve it.

You can download it for free here:
http://www.rogersaccesslibrary.com/forum/topic294.html.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
Back
Top