Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB6 and Crystal Reports 6 1

Status
Not open for further replies.

zivrap

Technical User
Aug 10, 2004
31
CA
Hello,

I have simple question regarding visual basic and crystal reports. I am using Crystal Reports 6 Professional and visual basic 6 professional. I have the follwing snippet of code which compiles and runs however there is one problem. When the report is opened for preview by the visual basic app, it is immediately(and automatically) closed again; the user does not have a chance to preview it.

Private Sub Command1_Click()
Dim crpApplication As CRPEAuto.Application
Dim crpReport As CRPEAuto.Report

Set crpApplication =CreateObject("crystal.crpe.application")
Set crpReport = crpApplication.OpenReport("C:\rep1.rpt")
crpReport.Preview
End sub

Any help would be much appreciated.
 
I think you've got a scope problem. Try moving the crpApplication declaration into the General Declarations.

-dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top