Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Preview multiple reports

Posted on 2011-02-19
8
Medium Priority
?
432 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
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 1000 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

715 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