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

Oracle and Crystal Report

Status
Not open for further replies.
Mar 19, 2003
57
US
I am using Crystal Report 7, Microsoft VB 6.0, and Oracle Client 8.

I have created a compiled executable that will export two files as MS Word document files. This works fine on the development workstation that has Crystal Reports 7, Microsoft VB 6.0, and Oracle Client 8. However, when I create a installation package to install the VB program on a test workstation, its fails to export the files. There are no error messages written to the NT event log viewer. I know the VB program gets as far as looking for DSN ODBC successfully, but it looks like the executable dies when it tries to logon to the Oracle database.

The test workstation has Oracle Client 8 installed. Below is the VB code. I have used this same VB code for exporting reports from a Sybase database connecting via ODBC, so I know the code works fine. Am I missing a specific Oracle file for my installation packag?

'Declare an instance of application object used to open the .rpt file.
Dim crxApplication As New CRAXDRT.Application

'Declare report object to start print job.
Public crxReport As CRAXDRT.Report

Private Sub Form_Load()

'Declare report array and report counter
Dim crxRptName(2) As String
Dim crxRptCnt As Integer

'Trap any errors that occur during export process
On Error GoTo export_error

'Set ODBC Connection to logon database server
crxApplication.LogOnServer "p2sodbc.dll", "ODBC - Test", "", "scott", "tiger"

'Set report array
crxRptName(0) = "NCAP"
crxRptName(1) = "NCAB"

'Loop through Array to reference RPT files
For crxRptCnt = 0 To 1

'Open the report
Set crxReport = crxApplication.OpenReport(App.Path & "\" & crxRptName(crxRptCnt) & ".rpt", 1)

'Set report to be exported to rich text format
crxReport.ExportOptions.FormatType = crEFTWordForWindows

'Set the destination type to disk
crxReport.ExportOptions.DestinationType = crEDTDiskFile

'Set the path and name of the exported document
If crxRptName(crxRptCnt) = "NCAP" Then
crxReport.ExportOptions.DiskFileName = "D:\NCAP\" & crxRptName(crxRptCnt) & CStr(Month(VBA.Date)) & CStr(Day(VBA.Date)) & CStr(Year(Date)) & ".doc"
ElseIf crxRptName(crxRptCnt) = "NCAB" Then
crxReport.ExportOptions.DiskFileName = "D:\NCAB\" & crxRptName(crxRptCnt) & CStr(Month(VBA.Date)) & CStr(Day(VBA.Date)) & CStr(Year(Date)) & ".doc"
End If

'Export the report without prompting the user
crxReport.Export (False)

Next

'Terminate startup form from memory
Unload FrmStartup

Exit Sub

export_error:
'Error Message Box during export
'MsgBox Err.Description & vbCrLf & Err.Number

'Log error message to window's eventlog
App.LogEvent vbCrLf & Err.Description & vbCrLf _
& Err.Number & vbCrLf & App.EXEName & "-Export Error @ Sub Form_LOAD()"
VBA.Err.Clear
Resume Next

End Sub

Private Sub Form_Terminate()

'Destroy report object from memory
Set crxReport = Nothing

'Log off database server
crxApplication.LogOffServer "p2sodbc.dll", "ODBC - Test", "", "scott", "tiger"

'Destroy application object from memory
Set crxApplication = Nothing

End Sub

 
You might try downloading the updated native Oracle driver from Crystal Decisions' website. I've run into similar problems using the p2sodbc driver; they don't occur with the native driver (pdsora7.dll).
 
Hi RJ,

Thanks for suggestion. I used the native Oracle P2SORA7.DLL driver, but I still had the same problem. I finally realized the problem was related to the function I was using in my report. This function uses the ufldateadd.dll. I had included this file in my installation package, but pointed it to the application installation directory rather than the winnt\system32 directory on the Test workstation. Once ufldateadd.dll file was added to the system32 directory on the Test workstation, it worked like a champ.

Thanks,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top