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

CRAXDRT error Missing or out of date dll when using crystal 8.5 in vb

Status
Not open for further replies.

rlevasseur

Programmer
May 19, 2000
18
US
I have created a small VB application for running a selected crystal 8.5 report in background. I open a SQL server query and loop through values to run report multiple times, creating a PDF exported report. The form is invisible. I used example on page 124 of Crystal 8.5 delelopers guide. When I create an install package and install on another machine I get a run time error 2147190548, Missing or out of date export dll. Error points to crxdrt.dll. The application runs fine on my workstation
Attached is code I am using. I need help getting this running on another machine.

I was using the old ocx control in prior versions, but users want reports in pdf format, without having to run reports. References to old ocx control have been removed

Any help anyone can give greatly appreciated

Thanks, Ray

-----------------------------------------------------
VB Code

Private Sub Form_Load()
On Error GoTo MISRptError
StartTime = Now()
sServer = "myserver"
sDatabaseName = "mydatabase"
sUserName = "mylogin"
sPassword = "mypassword"
cn.ConnectionTimeout = 2000
cn.Provider = "sqloledb"
cn.Properties("Data Source").Value = sServer
cn.Properties("Initial Catalog").Value = sDatabaseName
cn.Properties("User ID").Value = sUserName
cn.Properties("Password").Value = sPassword
cn.Open

Dim rs1 As ADODB.Recordset
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset


LogPath = "\\myserver\My path\MIS Extracts Out\ReportMailLog.txt"
Open LogPath For Output As #1
Print #1, "----------------------------------------------------"
Print #1, "Program : RptScheduler.exe "
Print #1, "Author : Ray Levasseur March 2002 MIS Department "
Print #1, "Purpose : Creates and e-mails selected reports in "
Print #1, " batch mode. "
Print #1, "----------------------------------------------------"
Print #1, "Started : " & Format(StartTime, "mm/dd/yyyy hh:mm:ss")


SqlStr = "Select AcctMgr, MgrEMail from AcctMgrInfo " & _
"where MgrEmail is not null " & _
"order by MgrSequence"

rs.Open SqlStr, cn
rs.MoveFirst

While Not rs.EOF

ParamStr = Trim(rs!AcctMgr)
RptFileName = "AcctMgrTest.rpt"
RptPath = "\\myserver\Mypath\Crystal Reports\"
RptOutPath = "\\myserver\My path\MIS Extracts Out\"
RptNamePath = Trim(RptPath & RptFileName)

Set Report = crxApplication.OpenReport(RptNamePath, 1)

For Each crxDatabaseTable In Report.Database.Tables
crxDatabaseTable.SetLogOnInfo CStr(sDatabaseName), CStr(sDatabaseName), CStr(sUserName), CStr(sPassword)

Next crxDatabaseTable

Set crxParameterField = Report.ParameterFields.Item(1)
crxParameterField.AddCurrentValue CStr(ParamStr)

Set crxExportOptions = Report.ExportOptions
crxExportOptions.DestinationType = crEDTDiskFile
crxExportOptions.FormatType = crEFTPortableDocFormat
crxExportOptions.DiskFileName = Trim(RptOutPath & "AcctMgrTest_" & ParamStr & ".pdf")
Report.DisplayProgressDialog = False
Report.Export False

CRViewer1.ReportSource = Report
CRViewer1.ViewReport

CRViewer1.Visible = False

Print #1, "Report generated for : " & ParamStr & " Mailto: " & Trim(rs!mgremail)

'If chkSendMail.Value = 1 Then
' SqlStr = "exec stp_rRptSendMail " & "'" & Trim(rs!mgremail) & "','" & Trim("AcctMgrTest_" & ParamStr & ".pdf") & "'"
' rs1.Open SqlStr, cn
'End If

rs.MoveNext
Wend

rs.Close

StopTime = Now()

Print #1, "Program Completed : " & Format(StopTime, "mm/dd/yyyy hh:mm:ss")
Close #1

cn.Close

MISRptError:
If Err.Number = 0 Then Exit Sub
Beep
MsgBox CStr(Err.Number) & " - " & Err.Description & vbCrLf & " Error during batch report creation " & vbCrLf & "." & vbCrLf & "Error cause: " & Err.Source
End
Exit Sub
End Sub

-----------------------------------------------------
module code

Option Explicit
Public cn As New ADODB.Connection
Public rs As ADODB.Recordset
Public SqlStr As String
Public RptPath As String
Public LogPath As String
Public RptFileName As String
Public RptNamePath As String
Public RptOutName As String
Public RptOutPath As String
Public sServer As String
Public sDatabaseName As String
Public sUserName As String
Public sPassword As String
Public bCancel As Boolean
Public cntr As Long
Public ParamStr As String
Public StartTime As Date
Public StopTime As Date
Public showdate As String
Public showcurr As String
Public crxApplication As New CRAXDRT.Application
Public Report As CRAXDRT.Report
Public crxDatabaseTable As CRAXDRT.DatabaseTable
Public crxParameterField As CRAXDRT.ParameterFieldDefinition
Public crxExportOptions As CRAXDRT.ExportOptions

Private Sub Main()
Load frmRptSched
End
End Sub





 
I have a program that does much the same. Sounds like there are some DLLs missing. In order to export to PDF using 8.5 you need (assuming CRAXDRT.DLL is installed) :

Windows\Crystal
ExportModeller.DLL (must be registered)
CrtSlv.DLL (must be registered)
CRXF_PDF.DLL

as well as the Export destination DLLs (eg U2DDISK.DLL). I had a problem with CRXF_PDF.DLL not appearing in the list of available export formats so I copied it to U2FPDF.DLL and it works fine.
 
Well I made that change and now error is physical database not found, I also did not understand the reference to u2pfdf.dll, and could not find that file. It would help if i knew what i was doing. Every time there's a Crystal upgrade, back to square one
 
You get the 'cannot find physical db file' error when the report was written using a db file that no longer exists eg you wrote the report using the db 'DB1.MDB'; 'DB1.MDB' now does not exist and your program is writing to 'DB2.MDB'. You need to update the location of the db file in your code something like as follows:

For Each crxDatabaseTable In Report.Database.Tables
crxDatabaseTable.SetLogOnInfo CStr(sDatabaseName), CStr(sDatabaseName), CStr(sUserName), CStr(sPassword)
'NEW CODE
'set the location of the physical db file
crxDatabaseTable.Location = sDatabaseName
'END NEW CODE
Next crxDatabaseTable

The bit about U2FPDF.DLL:
When you hit the export button on a Crystal Report you get a list of formats and destinations eg export to disk in format PDF. This information comes from the DLL files that are in the Crystal directory under the Windows directory. So, if the file U2FXLS.DLL exists, export to Excel is an option. If it does not exist, export to Excel is not an option. The documentation says that for CR 8.5 the export format file for PDF is CRXF_PDF.DLL but I found that sometimes even when that file was present in the Windows\Crystal directory, export to PDF was not an export format option. So, I copied the file CRXF_PDF.DLL to U2FPDF.DLL in the same directory and the export to PDF became an option.
 
Thanks for the tips, I also had to add a few more dll's for this to work as a stand-alone program on another machine. After adding msvcp60.dll, p2smon.dll, p2sodbc and ntwdblib.dll, the program now runs fine through a SQl server scheduled job I created; no errors!

Regards, Ray
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top