
Crystal Report Help Please or Tell me where to get Crystal Help
I posted this last friday and no one responded.
I have to get this to work today. Please.
I am using the code below and it works with one of my reports, but another
one that is very similar is not working. It gives me an
Error5 - Logon Failed after the oRpt.Export is performed
Private Sub CreateReport(ByVal sReport, ByVal sPDF, ByVal sConstitID, ByVal
sRptType)
' passes report location i.e c:\inetpub\wwwroot\report.rpt
' report custom formula i.e {Table.Field1}>1200
' displays report in browser (temp.pdf)
Dim exportOpts As New ExportOptions()
Dim oRpt As New ReportDocument()
Dim conTest As Boolean
Dim diskOpts As New DiskFileDestinationOptions()
Dim strFormula As String
'load report
oRpt.Load(sReport)
'log on to SQL server
Dim crLogonInfo As CrystalDecisions.Shared.TableLogOnInfo
crLogonInfo = oRpt.Database.Tables(0).LogOnInfo
crLogonInfo.ConnectionInfo.ServerName = "RE7"
crLogonInfo.ConnectionInfo.DatabaseName = "D"
crLogonInfo.ConnectionInfo.UserID = "REDBC"
crLogonInfo.ConnectionInfo.Password = "reodbc"
oRpt.Database.Tables(0).ApplyLogOnInfo(crLogonInfo)
'export report to viewer PDF
exportOpts = oRpt.ExportOptions
exportOpts.ExportDestinationType = ExportDestinationType.DiskFile
exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat '
ExportFormatType.WordForWindows, ExportFormatType.Excel other formats
'temp file name
diskOpts.DiskFileName = sPDF
exportOpts.DestinationOptions = diskOpts
oRpt.RecordSelectionFormula = oRpt.RecordSelectionFormula + "' and
{RECORDS.CONSTITUENT_ID}= '" & "'" & sConstitID & "'" 'existing formula +
custom
On Error GoTo Errcode
oRpt.Export()
If gRptErr = "" Then
oRpt.Close()
End If
End Sub
When I change my code to this line (just before the export)
oRpt.RecordSelectionFormula = oRpt.RecordSelectionFormula
and I don't add the formula that I need to, the report works, but I don't
get the results that I want obviously because the criteria that I want is
not specified.
Please Help me or give me direction on where I can post.
Thanks very much.
Wilson Bell