473,378 Members | 1,106 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,378 software developers and data experts.

Collate 2 Different Reports

Hello,

I have 2 reports that I want to collate (Report 1-Page 1, Report 2-Page 1,
Report 1-Page 2, Report 2-Page 2). I used the following code in a module I
found in Microsoft support article 231805:

Option Compare Database

'***********************************
'Declarations section of the module
'***********************************
Option Explicit
'************************************************* ********************
'NumPages is the number of pages in the largest report. If one report
'has fewer pages, the DoCmd.PrintOut statement for the smaller report
'runs correctly, and no additional pages are printed.
'************************************************* ********************
Function CollateReports(NumPages, Rpt1 As String, Rpt2 As String)
Dim MyPageNum As Integer

'Set the page number loop and alternate printing the report pages.
For MyPageNum = 1 To NumPages
'NumPages is the number of pages to print.
DoCmd.SelectObject acReport, Rpt1, True
DoCmd.PrintOut acPages, MyPageNum, MyPageNum
DoCmd.SelectObject acReport, Rpt2, True
DoCmd.PrintOut acPages, MyPageNum, MyPageNum
Next MyPageNum
End Function
This works great, but I have to specify the maximum # number of pages (1 in
this example) in:
? CollateReports(1, "Report 1", "Report 2")
Each week, the number of pages (1 per record) will be different. I can set
this value to a high number, but that sends a bunch of extra print jobs to
the printer. Even though no extra pages are printed, I'm sure there is a
better way. Is there a way to set the maximum number of pages
automatically?
Also, when I type

? CollateReports(1, "Report 1", "Report 2")

In the Immediate window, it prints fine with no error, but when I paste this
code into the on click event of a button on my form:
Private Sub Command16_Click()

Print CollateReports(1, "Report 1", "Report 2")

End Sub
it still prints fine, but I get this error:
Run-time error '438':

Object doesn't support this property or method.
Any help would be appreciated.
Thank You,

Chad
Nov 13 '05 #1
1 2255
Chad:

Another approach that you may want to consider is to make one report a
subreport of the other. Depending on where you embed the subreport in the
master report you can control the collation between the two reports.

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.
"ChadDiesel" <sh***********************@yahoo.com> wrote in message
news:ty***************@newsread2.news.atl.earthlin k.net...
Hello,

I have 2 reports that I want to collate (Report 1-Page 1, Report 2-Page 1,
Report 1-Page 2, Report 2-Page 2). I used the following code in a module I
found in Microsoft support article 231805:

Option Compare Database

'***********************************
'Declarations section of the module
'***********************************
Option Explicit
'************************************************* ********************
'NumPages is the number of pages in the largest report. If one report
'has fewer pages, the DoCmd.PrintOut statement for the smaller report
'runs correctly, and no additional pages are printed.
'************************************************* ********************
Function CollateReports(NumPages, Rpt1 As String, Rpt2 As String)
Dim MyPageNum As Integer

'Set the page number loop and alternate printing the report pages.
For MyPageNum = 1 To NumPages
'NumPages is the number of pages to print.
DoCmd.SelectObject acReport, Rpt1, True
DoCmd.PrintOut acPages, MyPageNum, MyPageNum
DoCmd.SelectObject acReport, Rpt2, True
DoCmd.PrintOut acPages, MyPageNum, MyPageNum
Next MyPageNum
End Function
This works great, but I have to specify the maximum # number of pages (1 in
this example) in:
? CollateReports(1, "Report 1", "Report 2")
Each week, the number of pages (1 per record) will be different. I can set
this value to a high number, but that sends a bunch of extra print jobs to
the printer. Even though no extra pages are printed, I'm sure there is a
better way. Is there a way to set the maximum number of pages
automatically?
Also, when I type

? CollateReports(1, "Report 1", "Report 2")

In the Immediate window, it prints fine with no error, but when I paste this
code into the on click event of a button on my form:
Private Sub Command16_Click()

Print CollateReports(1, "Report 1", "Report 2")

End Sub
it still prints fine, but I get this error:
Run-time error '438':

Object doesn't support this property or method.
Any help would be appreciated.
Thank You,

Chad

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Nanchil | last post by:
Hi, We created a database (DB2 UDB 7.2 on solaris 8) without this (COLLATE USING IDENTITY ) option. But we need this now for binary sorting. The database is siebel database. Is it possible to drop...
1
by: Dag Henriksson | last post by:
I'm trying to compare strings written in Swedish using: std::locale loc(""); // System locale is Swedish loc(first, second); But this does not give me the right return value. for example, ...
0
by: Francisco Araujo | last post by:
I don't know if this is a bug or if i'm doing something wrong, but when the print dialog is shown on VB.NET and the user select multiple-copies and check the collate option and click ok, the...
3
by: Robert Liles | last post by:
I am using Visual Basic.NET 2002 and cannot get "collate" from the PrintDialog1 or e.PageSettings.PrinterSettings.Collate to return anything but "False." What am I doing wrong? I am using...
0
by: Robert Liles | last post by:
If I check the "Collate" box in the PrintDialog it is ignored, always returns "False" and does not collate. If I add the line " e.PageSettings.PrinterSettings.Collate = True" in my print routine,...
1
by: Zengfa Gao | last post by:
Hi, all: I have a schema definition, worked fine for PostgreSQL 7.2 and 7.3. But I saw errors when I use it on PostgreSQL 7.4. Can anyone tell me what's changed in 7.4? Thanks a lot!
0
by: Ron Adam | last post by:
I've made a few more changes to my little collate module. There might be better ways to handle the options, or better choices for the options themselves. I tried to keep it as general as...
1
by: mabubakarpk | last post by:
HI. I am using SQL Server 2000. I generate a script of some table from EmpDB database when I run script in query analyzer it return error "Incorrect syntax near 'COLLATE'." Scripts is ...
1
by: baburk | last post by:
CREATE TABLE Employees( EmployeeID int IDENTITY(1,1) NOT NULL, LastName nvarchar(20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL) What is use of Collate. In what are all the places can we...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.