Solved

Crystal Report Designer for VB

Posted on 2002-06-20
8
554 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
[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 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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…

751 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