Solved

Preview multiple reports

Posted on 2011-02-19
8
428 Views
Last Modified: 2012-05-11
I have a single report that the user would like to preview for multiple clients.  I have run into this situation before and with the help of EE realized that to preview mulitple versions of the same report at the same time I have to create a new instance of the report for each preview.

The logic looks like this now:

Dim reportInstance As String  ' done so mulitple yield reports can be shown
'
reportInstance = getNextYieldReportInstance()
'
DoCmd.OpenReport reportInstance, acViewPreview, , , , oArgs

The instance is created using the routine in the code window.

I also have a routine to clean up all of the temorary instances

I am working on a similar conept for another client and handled it exactly the same way but it's not working.  When the logic that generates the multiple previews is complete only the last report generates is previewed.  I verified that all of the instance are being created correctly and you can see the correct previews on the screen as the report for each cuatomer is generated.  HOwever, at conclusion only the last report is avaialble for preview.

One difference between the reports is that the firts report I tried this with had no subreports and the new one that isn't working has two subreports.  I wanted to test this and can easily generate new instances of the subreports as I generate the new instance of the main report.  However, I don't know how to use code to revise the the new instance of the main report to use the new instances of the subreports ratehr than the originals.

I would appreciate any code showig how to revise the new isnatnce of the main report to use the two new insatnces of the supreports.  Or another suggestion as to how to preview multiple reports (with a subreport).

The main report name is
'wkRecap Rpt_Driver' and subreports are:
'subbrptWkRecp_1' and 'subReportWkRecap_2'

The reprot names in the coding example are from my old application, not the new one.
Public Function getNextYieldReportInstance() As String
'
DoCmd.SetWarnings False
gNumYieldReports = gNumYieldReports + 1
'
Dim newName As String
'
newName = cTempReportPrefix & "rptYieldReport" & Trim(Str(gNumYieldReports))
'
DoCmd.CopyObject , newName, acReport, "rptYieldReport"
'
getNextYieldReportInstance = newName
'
End Function

Open in new window

0
Comment
Question by:mlcktmguy
8 Comments
 
LVL 18

Expert Comment

by:Jerry Miller
ID: 34935147
Change this line to TRUE and see what kind of messages you are generating.
DoCmd.SetWarnings False

The messages you are suppressing may yield some clues as to what you have going on.
0
 
LVL 1

Author Comment

by:mlcktmguy
ID: 34944375
I made the chnage that you suggested and no erros or messages were displayed.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 34955768
<One difference between the reports is that the firts report I tried this with had no subreports and the new one that isn't working has two subreports.>
Then this would seem to be the key.

Remember that you only created multiple instances of the Main form originally.
Although a subform is embedded into a main report, it is not technically a "part" of the Main report.

So in this case you would have to create an instance of the subreport as well.

I can see this becoming messy as you would have to keep track of the subforms and how they are referenced as well.
This is the reason why (as "cool" as this technique seems) viewing multiple instances of a report/form is not commonly used.
Besides, (if you are doing this the way I suspect), creating new report objects on the fly, will boat the DB.
Do you have code to clean up the temp reports?

Just curious, what is the reason why your user can't view one report at a time?

JeffCoachman
0
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
LVL 1

Author Comment

by:mlcktmguy
ID: 34973656
The user wants to be able to click back and forth between the reports, reviewing the information.  If it looks good they want ot print them, otherwise they will rework the input.

I haven't gotten any means of presenting multiple versions of these reports together, even though it worked with the reports that didn't have sub reports.

As a work around I present each report using acdialog, when they close the report they are asked if they want to see another.

This isn't really what they want but it does enable them to see all versions (one at a time) before printing.

I dodn't have any problem creating multiple instances of the main reports and sub reports but have no idea how to link the new instances og the main report with the new instances of the sub reports.

As I mnetioned in my original post "I also have a routine to clean up all of the temorary instances" so the MDB does not get bloated.  I also have the 'compact on close' option checked so the MDB compacts every time they close it.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 34974374
Again, opening multiple instances of a From/Report is not commonly done, opening multiple instances of reports with subreports is rarer still.
Perhaps there is an Expert willing to help you with the specifics of doing this.
Please click the "Request Attention" link and ask that an alert be sent out for this Q.

Seeing multiple Report instances might be OK for a handful of Clients.
But how are you limiting this?, ...What if you have hundreds of Clients?!

JeffCoachman
0
 
LVL 1

Author Comment

by:mlcktmguy
ID: 34999932
I undertsand that this is not a common requirement but it is what my clients have asked for.  I try to accomodate my client's requests or offer acceptable alternatives.

Each user has a copy of the procedures on thier local machine (C: drive) and that is what they execute.  The reports are created in each of their local copies.  The number of users doing this would be under 10 at any one time but they are all independant of each other.

Only the data is on the network server, each of the local copies of the Procedures (Forms, queries, reports, etc..) are linked ot it.

0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35000321
Again, perhaps another Expert will be willing to take this on...
0
 
LVL 21

Accepted Solution

by:
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 250 total points
ID: 35003542
I have always avaided tryng to opebn multiple instances of the same report object.

I do have a solutiont hat works great.   I use the acess snap shot viewer for my print previews. I send each repor to a snapshot file (.snp) then ShellExec to open each onw. The snapshot view looks and works very similar to the print preview.

** Note: It does require the free snapshot viwer to be installed. **

I also do theg same thing using PDF's.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question