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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Integrated CR8.5 and VB6.0 and got compile error

Status
Not open for further replies.

christiey

IS-IT--Management
Dec 28, 2001
12
US
I created a Crystal Report using CR 8.5 developer edition and I tried to integrate it to VB 6.0 (backend is Win2K). I added all crystal controls from project\references and project\components (Controls and Designers). I am new in this area and need help. The following is part of my code:

In main.bas
Public Application as CRAXDRT.Application
Public Report as CRAXDRT.Report

In frmView
Set Application = New CRAXDDRT.Application
Set Report = Application.OpenReport(App.Path & "\Report1.rpt")

Private Sub form_load()
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
End Sub

I tried to run it and got compile error "Invalid Outside Procedure" and "Set" was highlighted.
Help!!!
 
I found the problem -- I didn't add CRViewer1 to the project. As soon as I did that, I can view the report or print it. But I have other problem now: I got other message from CRYSTAL REPORT VIEWER : "Server has not yet been opened" when I added the refresh data command -- Report.DiscardSaveData. Can someone tell what else I need to add to codes so the report can be refreshed everytime it runs?

Thanks!
 
You have to set the database type and login info. into your script...this is why you're getting the "server has not yet been opened" error...the application doesn't know how to refresh the report without this info.
 
Our Database is Oracle 8, database name is "Test", UserId is "User" and password is "PWD". Can someone show me how to set the database and login info in the script?
Thanks!
 
Report.Database.Tables(1).SetLogOnInfo "Test", "", "User", "PWD"
 
It works! Thanks very much! I seached on books and developer's guide but I can't find the syntax for this.
You make my day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top