[RESOLVED] VB6 Crystal Report Error 20515
I'm trying to run a crystal report from vb6 and I'm getting an error 20515 from the following code, any help will be appreciated.
Code:
Private Sub MnuPurficationRoutinemasterList_Click()
On Error GoTo HandleError
Dim ReportName As String
Dim lcReturnValue As String
Dim lcNetworkPath As String
Dim lcEntityName As String
Dim lrsPurficationRoutineMasterReportData As ADOR.Recordset
Dim loReports As TrxObject.clsReports
Set loReports = New TrxObject.clsReports
lcNetworkPath = "C:\SourceSafe\Tracs\TRACS7.0\client\"
'lcNetworkPath = GetNetworkPath
Set lrsPurficationRoutineMasterReportData = loReports.GetPurficationRoutineMasterListRS
Screen.MousePointer = vbHourglass
If Dir(lcNetworkPath & "ReportsSQL\" & "PurficationRoutineMasterList.rpt") = "" Then
MsgBox "Report Not Available.", vbCritical, "Report Error"
Else
CrystalReport1.ReportFileName = lcNetworkPath & "ReportsSQL\" & "PurficationRoutineMasterList.rpt"
CrystalReport1.SetTablePrivateData 0, 3, lrsPurficationRoutineMasterReportData
CrystalReport1.Destination = crptToWindow
CrystalReport1.WindowTitle = "Tax Partners, L.L.C. - TRACS Reporting"
CrystalReport1.WindowLeft = 0
CrystalReport1.WindowWidth = 800
CrystalReport1.WindowTop = 70
CrystalReport1.WindowHeight = 500
'If lrsTaxReturn.EOF = True Then
' lrsTaxReturn.AddNew
' lrsTaxReturn("Name") = goEntity.Name
' lrsTaxReturn.Update
'End If
lcReturnValue = CrystalReport1.PrintReport ' Generate the report
If Val(lcReturnValue) > 0 Then
MsgBox "Error Number: " & lcReturnValue & Chr(13) & " Report Not Created."
End If
' The reset method clear Crystal from memory. This
' allow the user to view one report, release the report and
' then view the next report quickly thereafter.
' Without the reset method the next report can not be viewed
' until 4 or 5 seconds later, because the previous crystal
' file was not being released from memory fast enough.
CrystalReport1.Reset
End If
Screen.MousePointer = vbDefault
Exit Sub
HandleError:
Dim liReturnValue As Integer
liReturnValue = CentralErrorHandler(Err.Number, "MnuPurficationRoutinemasterList_Click", _
"frmMain", "TRACS.vbp")
If liReturnValue = 0 Then
Resume
ElseIf liReturnValue = 1 Then
Resume Next
ElseIf liReturnValue = 2 Then
Exit Sub
End If
End Sub
Re: VB6 Crystal Report Error 20515
What is the wording of the error message an on what line does it happen?
Re: VB6 Crystal Report Error 20515
It returns the string "20515" with the following:
lcReturnValue = CrystalReport1.PrintReport ' Generate the report
Re: VB6 Crystal Report Error 20515
Oh, you have error trapping on.
Comment out the On Error GoTo and let it give you a run time error. That will generate the actual text of the error message and when you click "Debug" it will take you to the line that caused it.
Re: VB6 Crystal Report Error 20515
I commented it out but it ran without error but the report didn't display.
Re: VB6 Crystal Report Error 20515
20515 means there is an error in one of the report formulas.
PrintReport does not raise runtime errors. You would need to use the Action property, although you would probably just get Error # 20515, "Error in Formula".
Re: VB6 Crystal Report Error 20515
Thanks, I had an incorrect formula with one of my fields.