I’m having an issue with a crystal report with an embedded image. The graphic location is set to a formula field that points to a URL. The URL is a webpage that dynamically generates an jpg.
The issue is that the graphic shows and prints properly when launched via Crystal. But when I try to print the report via a VB app the report prints without the dynamically generated image.
This applications works on two other machines but it’s not working on this new machine that we just rolled out. Could this be a timeout or something?
Here is the code that launches the report in VB.
--Rick
The issue is that the graphic shows and prints properly when launched via Crystal. But when I try to print the report via a VB app the report prints without the dynamically generated image.
This applications works on two other machines but it’s not working on this new machine that we just rolled out. Could this be a timeout or something?
Here is the code that launches the report in VB.
Code:
Public Sub printLabelRPT()
Dim objCRApplication As New CRAXDRT.Application
Dim objCRReport As CRAXDRT.Report
Dim prn As Printer
Dim i As Integer
Dim foundPrinter As Boolean
If CurrentSheetNumber > 0 Then
On Error GoTo ErrorPrint
Screen.MousePointer = vbHourglass
Set objCRReport = objCRApplication.OpenReport(App.Path & "\crystal\snyderlabel.rpt")
foundPrinter = False
'detect datamax printer
For i = 0 To Printers.Count
If InStr(Printers.Item(i).DeviceName, "Datamax") Then
Set prn = Printers.Item(i)
foundPrinter = True
Exit For
End If
Next i
If Not foundPrinter Then
MsgBox "Could not detect Datamax printer!", vbCritical, "Printer Not Found"
Exit Sub
End If
'set parameters
'@sheetID
'no default
objCRReport.ParameterFields(1).ClearCurrentValueAndRange
objCRReport.ParameterFields.Item(1).AddCurrentValue CurrentSheetNumber
'@server
'default: localhost
objCRReport.ParameterFields(2).ClearCurrentValueAndRange
'objCRReport.ParameterFields.Item(2).AddCurrentValue "10.0.0.29" ' APM1
objCRReport.ParameterFields.Item(2).AddCurrentValue APM ' APM2
'@height
'default: 300
objCRReport.ParameterFields(3).ClearCurrentValueAndRange
objCRReport.ParameterFields.Item(3).AddCurrentValue "300"
'@width
'default: 300
objCRReport.ParameterFields(4).ClearCurrentValueAndRange
objCRReport.ParameterFields.Item(4).AddCurrentValue "300"
'@fillColor
'default: black ***use all lower case
objCRReport.ParameterFields(5).ClearCurrentValueAndRange
objCRReport.ParameterFields.Item(5).AddCurrentValue "black"
'@font
'default: Arial
objCRReport.ParameterFields(6).ClearCurrentValueAndRange
objCRReport.ParameterFields.Item(6).AddCurrentValue "Arial"
'@fontSize
'default: 40
objCRReport.ParameterFields(7).ClearCurrentValueAndRange
objCRReport.ParameterFields.Item(7).AddCurrentValue "40"
'setup printer
objCRReport.SelectPrinter prn.DriverName, prn.DeviceName, CStr(prn.Port)
objCRReport.DisplayProgressDialog = False
'Log on to server
'objCRReport.Database.LogOnServer "P2ssql.dl", "10.0.0.29\SQLEXPRESS", "tps", "sa", "sa1234" ' APM1
objCRReport.Database.LogOnServer "P2ssql.dl", APM & "\SQLEXPRESS", "tps", "sa", "sa1234" ' APM2
objCRReport.Database.Tables(1).ConnectionProperties.Item("password") = "sa1234"
'print report
objCRReport.PrintOut False
'clean-up
Set objCRReport = Nothing
Screen.MousePointer = vbDefault
Else
MsgBox "No Labels to Print", vbOKOnly, "No Labels"
End If
On Error Resume Next
Exit Sub
ErrorPrint:
Screen.MousePointer = vbHourglass
MsgBox "Error Printing Labels", vbOKOnly, "Print Error"
On Error Resume Next
End Sub
--Rick