I've written a tiny VB6 standard .exe that calls a Crystal Reports version 8.5 report, exports it to .pdf format and saves it to a disk file. The .exe runs on the Crystal Server machine, there is no client-side code or client-side installation. When I launch it from a DOS prompt on my own, Win NT 4 PC, the exe runs fine. But if I launch it with the same command line from any other PC I get "Run-time error 429: ActiveX can't create component'. I've already verified that all the DLLs referenced by my exe are on the Crystal Server and are the same version as my own PC. What could the problem be? Thanks in advance for any help. Here's my code:
'*************************************************************
'SET THE REPORT OBJECT
'*************************************************************
Dim varFolder As String
varFolder = "PL1302153"
Dim crxApplication As CRAXDRT.Application
Set crxApplication = New CRAXDRT.Application '<----fails here
Dim crxReport As CRAXDRT.Report
Set crxReport = crxApplication.OpenReport(App.Path & "\SPL.rpt"
Dim crxSubreport As CRAXDRT.Report
Set crxSubreport = crxReport.OpenSubreport("Is_Was_sub.rpt"
crxReport.Database.SetDataSource Read_Text_File_Main, 3, 1
crxSubreport.Database.SetDataSource Read_Text_File_Sub, 3, 1
'************************************************************
'SET .PDF PARAMETERS AND OPTIONS '*************************************************************
'specify pdf format for output file
crxReport.ExportOptions.FormatType = crEFTPortableDocFormat
'specify output destination as disk file
crxReport.ExportOptions.DestinationType = crEDTDiskFile
'Assign the export file name and location
crxReport.ExportOptions.DiskFileName = varFolder & "/" & varFolder & ".pdf"
'Set option to export all pages of report to .pdf file to true
crxReport.ExportOptions.PDFExportAllPages = True
'*************************************************************
'RUN THE EXPORT
'*************************************************************
crxReport.Export (True)
'*************************************************************
'CLOSE THE APPLICATION WINDOW, SHUT DOWN
'*************************************************************
Unload Me
End Sub
Private Function Read_Text_File_Main() As ADODB.Recordset
Dim rsMain As ADODB.Recordset
Set rsMain = New ADODB.Recordset
Dim connMain As ADODB.Connection
Set connMain = New ADODB.Connection
connMain.Open "DRIVER={Microsoft Text Driver (*.txt; *.csv)}" & _
";DBQ=" & App.Path & "\" & varFolder & "\" & _
";DefaultDir=" & App.Path & _
";Uid=Admin;Pwd=;"
rsMain.Open "SELECT * FROM " & App.Path & "\" & varFolder & "\SPL_reportdata.csv", connMain, adOpenStatic, adLockReadOnly, adCmdText
Set Read_Text_File_Main = rsMain
Set rsMain = Nothing
Set connMain = Nothing
End Function
Private Function Read_Text_File_Sub() As ADODB.Recordset
Dim rsSub As ADODB.Recordset
Set rsSub = New ADODB.Recordset
Dim connSub As ADODB.Connection
Set connSub = New ADODB.Connection
connSub.Open "DRIVER={Microsoft Text Driver (*.txt; *.csv)}" & _
";DBQ=" & App.Path & "\" & varFolder & "\" & _
";DefaultDir=" & App.Path & _
";Uid=Admin;Pwd=;"
rsSub.Open "SELECT * FROM " & App.Path & "\" & varFolder & "\IS_WAS.csv", connSub, adOpenStatic, adLockReadOnly, adCmdText
Set Read_Text_File_Sub = rsSub
Set rsSub = Nothing
Set connSub = Nothing
End Function
Private Sub Form_Unload(Cancel As Integer)
'Set the objects to 'Nothing' to remove them from memory.
'This ensures that each time you use these objects
'they are recreated and populated with new data.
Set crxReport = Nothing
Set crxSubreport = Nothing
End Sub
'*************************************************************
'SET THE REPORT OBJECT
'*************************************************************
Dim varFolder As String
varFolder = "PL1302153"
Dim crxApplication As CRAXDRT.Application
Set crxApplication = New CRAXDRT.Application '<----fails here
Dim crxReport As CRAXDRT.Report
Set crxReport = crxApplication.OpenReport(App.Path & "\SPL.rpt"
Dim crxSubreport As CRAXDRT.Report
Set crxSubreport = crxReport.OpenSubreport("Is_Was_sub.rpt"
crxReport.Database.SetDataSource Read_Text_File_Main, 3, 1
crxSubreport.Database.SetDataSource Read_Text_File_Sub, 3, 1
'************************************************************
'SET .PDF PARAMETERS AND OPTIONS '*************************************************************
'specify pdf format for output file
crxReport.ExportOptions.FormatType = crEFTPortableDocFormat
'specify output destination as disk file
crxReport.ExportOptions.DestinationType = crEDTDiskFile
'Assign the export file name and location
crxReport.ExportOptions.DiskFileName = varFolder & "/" & varFolder & ".pdf"
'Set option to export all pages of report to .pdf file to true
crxReport.ExportOptions.PDFExportAllPages = True
'*************************************************************
'RUN THE EXPORT
'*************************************************************
crxReport.Export (True)
'*************************************************************
'CLOSE THE APPLICATION WINDOW, SHUT DOWN
'*************************************************************
Unload Me
End Sub
Private Function Read_Text_File_Main() As ADODB.Recordset
Dim rsMain As ADODB.Recordset
Set rsMain = New ADODB.Recordset
Dim connMain As ADODB.Connection
Set connMain = New ADODB.Connection
connMain.Open "DRIVER={Microsoft Text Driver (*.txt; *.csv)}" & _
";DBQ=" & App.Path & "\" & varFolder & "\" & _
";DefaultDir=" & App.Path & _
";Uid=Admin;Pwd=;"
rsMain.Open "SELECT * FROM " & App.Path & "\" & varFolder & "\SPL_reportdata.csv", connMain, adOpenStatic, adLockReadOnly, adCmdText
Set Read_Text_File_Main = rsMain
Set rsMain = Nothing
Set connMain = Nothing
End Function
Private Function Read_Text_File_Sub() As ADODB.Recordset
Dim rsSub As ADODB.Recordset
Set rsSub = New ADODB.Recordset
Dim connSub As ADODB.Connection
Set connSub = New ADODB.Connection
connSub.Open "DRIVER={Microsoft Text Driver (*.txt; *.csv)}" & _
";DBQ=" & App.Path & "\" & varFolder & "\" & _
";DefaultDir=" & App.Path & _
";Uid=Admin;Pwd=;"
rsSub.Open "SELECT * FROM " & App.Path & "\" & varFolder & "\IS_WAS.csv", connSub, adOpenStatic, adLockReadOnly, adCmdText
Set Read_Text_File_Sub = rsSub
Set rsSub = Nothing
Set connSub = Nothing
End Function
Private Sub Form_Unload(Cancel As Integer)
'Set the objects to 'Nothing' to remove them from memory.
'This ensures that each time you use these objects
'they are recreated and populated with new data.
Set crxReport = Nothing
Set crxSubreport = Nothing
End Sub