question911
MIS
Crystal Report 9 Dev Edition
Informix DB 7
Informix Client 2.81
VB6
NT 4.0
I'm using the DataDirect ODBC driver (CR Informix ODBC 4.10) to access Informix DB. I can manually run and export the report in Crystal Report connected via the ODBC driver mentioned above, however, when I try to run and export the same report using RDC in VB6, my program errors out after the export line of code is executed. I cannot see the error out message. Below is my VB code. I tried to use "P2SINFX.DLL" in my VB code, but problem persists.I I also tried to use the "IBM Informix 3.82 32 bit" ODBC driver and the "Crystal Native Online driver." In both cases, I changed the connections in the report using Crystal Report, but the report runs very slow using the two drivers mentioned above compared to using DataDirect ODBC driver (CR Informix ODBC 4.10). Whats wierd is that the same VB code using RDC runs slow and now the export is SUCCESSFUL. The only difference is that I changed the connection in the report. Anyone know why I can't use DataDirect ODBC driver (CR Informix ODBC 4.10) with RDC in VB 6?
'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 Connection to logon database server
crxApplication.LogOnServer "crdb_p2sifmx.dll", "online", "views", "user", "user"
'Set report array
crxRptName(0) = "Report1"
crxRptName(1) = "Report2"
crxRptName(2) = "Report3"
'Loop through Array to reference RPT files
For crxRptCnt = 0 To 2
'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 = crEFTText
'Set the destination type to disk
crxReport.ExportOptions.DestinationType = crEDTDiskFile
'Set the path and name of the exported document
If crxRptName(crxRptCnt) = "Report1" Then
crxReport.ExportOptions.DiskFileName = "C:\Data\" & crxRptName(crxRptCnt) & ".txt"
ElseIf crxRptName(crxRptCnt) = "Report2" Then
crxReport.ExportOptions.DiskFileName = "C:\Data\" & "Interval_14_30M_CC" & (crxRptCnt) & CStr(Year(crxDate)) & "_" & crxMonth & "_" & CStr(Day(crxDate)) & ".txt"
ElseIf crxRptName(crxRptCnt) = "Report3" Then
crxReport.ExportOptions.DiskFileName = "C:\Data\" & "Interval_254_30M_CC" & (crxRptCnt) & CStr(Year(crxDate)) & "_" & crxMonth & "_" & CStr(Day(crxDate)) & ".txt"
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 "crdb_p2sifmx.dll", "online", "views", "user", "user"
'Destroy application object from memory
Set crxApplication = Nothing
End Sub
Informix DB 7
Informix Client 2.81
VB6
NT 4.0
I'm using the DataDirect ODBC driver (CR Informix ODBC 4.10) to access Informix DB. I can manually run and export the report in Crystal Report connected via the ODBC driver mentioned above, however, when I try to run and export the same report using RDC in VB6, my program errors out after the export line of code is executed. I cannot see the error out message. Below is my VB code. I tried to use "P2SINFX.DLL" in my VB code, but problem persists.I I also tried to use the "IBM Informix 3.82 32 bit" ODBC driver and the "Crystal Native Online driver." In both cases, I changed the connections in the report using Crystal Report, but the report runs very slow using the two drivers mentioned above compared to using DataDirect ODBC driver (CR Informix ODBC 4.10). Whats wierd is that the same VB code using RDC runs slow and now the export is SUCCESSFUL. The only difference is that I changed the connection in the report. Anyone know why I can't use DataDirect ODBC driver (CR Informix ODBC 4.10) with RDC in VB 6?
'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 Connection to logon database server
crxApplication.LogOnServer "crdb_p2sifmx.dll", "online", "views", "user", "user"
'Set report array
crxRptName(0) = "Report1"
crxRptName(1) = "Report2"
crxRptName(2) = "Report3"
'Loop through Array to reference RPT files
For crxRptCnt = 0 To 2
'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 = crEFTText
'Set the destination type to disk
crxReport.ExportOptions.DestinationType = crEDTDiskFile
'Set the path and name of the exported document
If crxRptName(crxRptCnt) = "Report1" Then
crxReport.ExportOptions.DiskFileName = "C:\Data\" & crxRptName(crxRptCnt) & ".txt"
ElseIf crxRptName(crxRptCnt) = "Report2" Then
crxReport.ExportOptions.DiskFileName = "C:\Data\" & "Interval_14_30M_CC" & (crxRptCnt) & CStr(Year(crxDate)) & "_" & crxMonth & "_" & CStr(Day(crxDate)) & ".txt"
ElseIf crxRptName(crxRptCnt) = "Report3" Then
crxReport.ExportOptions.DiskFileName = "C:\Data\" & "Interval_254_30M_CC" & (crxRptCnt) & CStr(Year(crxDate)) & "_" & crxMonth & "_" & CStr(Day(crxDate)) & ".txt"
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 "crdb_p2sifmx.dll", "online", "views", "user", "user"
'Destroy application object from memory
Set crxApplication = Nothing
End Sub