Solved

Crystal Report Designer for VB

Posted on 2002-06-20
8
549 Views
Last Modified: 2012-08-13
I Wish to print a report automatically from VB using CR ,

The code should be
CRViewer1.PrintReport

but it will only show up a print menu to let you press to
print from page to page.

What will be the parameter to pass in to let it printout automatically?

Also how to pass filed parameter to print a specify range of report?

I used to use the object of "Crystal report" and pass parameter through it.


Thanks very much.
0
Comment
Question by:sssssss
8 Comments
 
LVL 3

Accepted Solution

by:
Elmo_ earned 100 total points
ID: 7095233
sssssss,

To Print directly to the printer you will need to set the "Destination" property. And to select the range you will need to use the "PrinterStartPage" And "PrinterStopPage" properties.

Here are the details of these three properties along with examples:

---------------------------------------------------
Destination

Description

Specifies the destination to which your report is to be printed (Window, Printer, or File).

Runtime Usage
[form.]CrystalReport.Destination[= Destination%]
For example:
CrystalReport1.Destination = 0
     
«sends the specified report to a print window.»

Remarks
Select one of the following print destinations:
0      0 =Window (sends the report to a print window)     crptToWindow
1      1 =Printer (sends the report to a printer)     crptToPrinter
2      2 =File (prints the report to a disk file for printing at a later time or for importing into other applications. If you select this property, you will also have to set the PrintFileName and PrintFileType properties.)     crptToFile
3      3 =EMail via MAPI (sends the report to another person on your network via MAPI Email (Microsoft Mail). The report is attached to the EMail letter in the format specified by the PrintFileType property.)     crptMapi
     
Availability
Design time; Runtime
---------------------------------------------------

To Specify the Print Range you will need to use PrinterStartPage And PrinterStopPage.  
---------------------------------------------------
PrinterStartPage

Description

Sets the first page to be printed.
Runtime Usage
[form.]CrystalReport.PrinterStartPage[= StartPage%]
For example:
CrystalReport1.PrinterStartPage = 7
     
«Specifies that printing is to begin with page 7 of the report.»

Remarks
If a value less than or equal to 0 is used for PrinterStartPage, the value is ignored and printing starts with page 1.

Availability
Design time, Runtime


PrinterStopPage

Description
Sets the last page to be printed.

Runtime Usage
[form.]CrystalReport.PrinterStopPage[=StopPage%]
For example:
CrystalReport1.PrinterStopPage = 12
     
«Specifies that the printing is to end with page 12 of the report.»

Remarks
Use a value of -1 for PrinterStopPage to indicate that printing is to continue through to the last page.

Availability
Design time, Runtime
---------------------------------------------------

Hope this helps

Ed.
0
 
LVL 1

Expert Comment

by:Benjy
ID: 7095297
use:
reportname.PrintOut False, 1
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 7096430
listening
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

Expert Comment

by:omarmallat
ID: 7098970
only use these two property to print a crystal file directly to printer:
    crp1.Destination = crptToPrinter
    crp1.Action = 1
0
 
LVL 3

Expert Comment

by:Elmo_
ID: 7173792
SSSSSSS,

Any update here? It hass been a month now.  Could you please close out this question?

Cheers,

Ed.
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7197479
sssssss,

A request has been made that a Moderator close this question, and our records show that you logged in within the last month or so.

Please accept the responsibility you agreed to when you joined Experts Exchange and resolve this question.

EXPERTS: Please leave your thoughts as to what should be done with this question (delete, PAQ, or award to an Expert) within the next seven (7) days. If the Asker does not respond within that time frame, I or another Moderator will close this question.

Netminder
CS Moderator
0
 
LVL 3

Expert Comment

by:Elmo_
ID: 7208654
Netminder,

I think that I should be awarded the points as I was the first to respond with a valid answer.

Cheers,

Ed.
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7209181
Agreed. Force-accepted.

Netminder
CS Moderator
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA error replacing data 6 39
MS Access - Capture pressed key onclick 4 33
passing parameter in sql procedure 9 61
How does CurrentUser work? 10 37
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

785 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