question911
MIS
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
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