473,385 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Preview multiple instances of dynamically altered report

Hi, all!

I have a report with quite a few fields that are hidden and moved depending on if they are tracked by the user or not. The report is previewing and printing just fine. However, my user wants to be able to open the same report in preview mode for multiple wells selected from a list box. So, one report might have 20 fields visible, and the next might only have 15 fields visible. I can get it to print one right after the other, but it will only preview the last one selected. Any ideas on how I can get the report to preview one right after the other?

Any help is appreciated!

Thanks,
Brandi
Jun 17 '10 #1
6 2951
jimatqsi
1,271 Expert 1GB
Please show us the code you are using to launch the report(s) now. That way we'll have a common starting point for discussion.

Thanks,
Jim
Jun 17 '10 #2
I have a form where the user selects the desired report and enters any criteria into text boxes or selects from combo/list boxes. There is code that gets the name of the report and a function that creates the where clause. Here's the basic code for printing the report:

'Print a separate report for each Well
Set db = CurrentDb
Set qdf = db.QueryDefs("qryWells") ‘Active WellIDs
strSQL = qdf.SQL

Set rst = db.OpenRecordset(strSQL, dbOpenDynaset)

strNewWhere = ""

With rst
If .RecordCount <> 0 Then
.MoveFirst
Do Until .EOF
strNewWhere = strWhere & " AND WellID = " & !WellID
DoCmd.OpenReport strDocName, lngView, , strNewWhere
.MoveNext
Loop
End If
End With

Set qdf = Nothing
Set rst = Nothing
Set db = Nothing

Where:
strDocName = “rptWellLog”
strWhere = "ReadDate Between #5/1/10# And #5/9/10#"
lngView = 0 ‘Print

Thanks!
Jun 17 '10 #3
jimatqsi
1,271 Expert 1GB
Shouldn't lngview be acPreview if you want to preview these reports? I don't see lngview being set, so I don't understand why they don't all behave the same way.

Jim
Jun 17 '10 #4
@jimatqsi
This is all in a function, and when I call the function, I pass it lngView. It prints each one fine, but only previews the last one. I think it opens each one, but the user only sees the last one because each time it opens a new one, it replaces the one before it. Somehow I'm going to have to dynamically create a copy of the original report for each well and open each one right after each other. Does that make sense?
Jun 18 '10 #5
jimatqsi
1,271 Expert 1GB
You could go right to .pdf files and specify they should be opened. That would do it, but it's not really a preview.
Jun 18 '10 #6
FishVal
2,653 Expert 2GB
You may instantiate the same report class (Reprt_<report name>) as multiple instances via global object variables.

Example:

Expand|Select|Wrap|Line Numbers
  1. Dim col As New VBA.Collection
  2.  
  3.  
  4. Private Sub btn_Click()
  5.  
  6.     Dim rpt As Report_rpt
  7.     Set rpt = New Report_rpt
  8.     rpt.Visible = True
  9.     col.Add rpt
  10.  
  11. End Sub
  12.  
  13.  
Jun 21 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Bruce | last post by:
I am writing an installer that needs to put a dll file with a bunch of extended stored procedures in the BINN directory. The problem is that if the machine is running multiple instances of SQL...
2
by: (Pete Cresswell) | last post by:
I have a situation where a bunch of statistics are being presented based on a mutual fund and a benchmark fund's monthly and quarterly returns for a given period (like 10 years....) The hitch...
3
by: sara | last post by:
I've been reading all the posts on this topic. Most are years old, so I have 2 questions: 1. Is there any improvement on opening the same report multiple times (with different input parameters...
6
by: Bob Alston | last post by:
Looking for someone with experience building apps with multiple instances of forms open. I am building an app for a nonprofit organizations case workers. They provide services to the elderly. ...
6
by: Bugs | last post by:
Does anyone have any recommendations on the best way to create multiple instances of the same class when the final number of instances is unknown? For example, I have a class and based on some...
6
by: Savante | last post by:
I have been writing a datalogging application. It reads in double's into a database. I want to be able to click on a row in a database (holds name of variable and also current value of variable)...
4
by: nottarealaddress | last post by:
I'm trying to get my feet wet in VB2005 (our new standard at work after officially stopping new development in VB6 about a month ago). I'm working with a simple sql 2005 table of 50 entries, one...
2
LegalIT
by: LegalIT | last post by:
Hello, I have a VB.net application that creates reports from database information. I am able to create the reports fine. The problem is each time I create a report my application starts a new...
1
by: manontheedge | last post by:
I'm trying to create multiple instances of a class dynamically. For example ... Class A { ... ... };
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.