Solved

Crystal Report Designer for VB

Posted on 2002-06-20
8
546 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
 

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Share codes 68 114
Convert Excel Column Headers to Rows 8 81
vba find the last empty column 10 81
Put text in a picture ASP.NET C# 2 36
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

708 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now