Export crystal report + oracle database in VB
I create one standard exe file.
Then I add in a crystal report file with
oracle ODBC connection named as CrystalReport1
Together I add a crystal report viewer.
When I run the program, I got this error
"Server has not yet been opened"
This is the command to export the report out to pdf.
Private Sub Command1_Click()
Dim Report As New CrystalReport1
filedb = App.Path
With Report
.ExportOptions.ODBCDataSourceName = "DSNname"
.ExportOptions.ODBCDataSourceUserID = "Username"
.ExportOptions.ODBCDataSourcePassword = "Password"
.ExportOptions.FormatType = crEFTPortableDocFormat
.ExportOptions.DestinationType = crEDTDiskFile
.ExportOptions.DiskFileName = filedb & "VehicleExp.pdf"
.Export False
End With
End Sub
---------------------------------------
anybody please help me to solve this problem..
thanks
Re: Export crystal report + oracle database in VB
Welcome to the Forums.
"Server has not yet been opened" error usually meand that you havent
properly opened the report with the correct credientials. Try checking out
the Report.Database.Tables(1).SetLogOnInfo sServer, sDatabase, sUserName,
sUserPwd before you open yuor report.
Also, here is a link to one of my examples for using an ADO rs with the CR
Viewer Control.
HTH
Re: Export crystal report + oracle database in VB
I still having a problem if using the above solution because my report are
using Oracle Database.
Now im using CrystalReport object to export and it was OK.
Below is my code. Just one problem, when i export to RTF, how to bypass dialog box that ask for the Page Range? I want it to export all page.
Private Sub RouteWOAgingReport()
dtFrom = "01/" & strMth & "/" & strYear
dtTo = "23/" & strMth & "/" & strYear
With rptReport
.Connect = "DSN=PROD;UID=Username;PWD=Password;"
.ReportFileName = App.Path & "\" & "rptRouteWOAging.rpt"
.ParameterFields(0) = "DateFrom;" & dtFrom & ";true;"
.ParameterFields(1) = "DateTo;" & dtTo & ";true;"
.ParameterFields(2) = "UnitOffice;" & strUnitOffice & ";true"
.PrintFileType = crptRTF
.PrintFileName = Filedb & "\" & "Route WO Aging.rtf"
.Destination = crptToFile
.ProgressDialog = False
.PrintReport
End With
strReportName = "Route WO Aging.xls"
SendEmail (strReportName)
End Sub
Re: Export crystal report + oracle database in VB
Bump...
somebody please help..
thanks..
Re: Export crystal report + oracle database in VB
Here is one of my examples on export CR. You need to add the reference for exporting and use the .ExportOptions object.