Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am using crystal reports 8.5 for first time with vb 6.0.
Actually i was trying to find all the possible errors i can catch in crystal reports that can occur.

VB
Dim intDate As Integer
    Dim strReportName As String
    Dim crxApplication As New CRAXDRT.Application
    Dim Report As CRAXDRT.Report
    
    'On Error GoTo ErrHandler
    Me.MousePointer = vbHourglass
    intDate = Weekday(Now)
    
    strReportName = mstrReportFolder & "\Claims\ClaimProductionByProcessorByDateByType.rpt"
        
    Set Report = crxApplication.OpenReport(strReportName)
    Report.Database.LogOnServer "pdsodbc.dll", "*******", "Claims", mstrUID, mstrPWD
    Report.RecordSelectionFormula = mstrSQL
    Report.ExportOptions.DestinationType = crEDTDiskFile
    Report.ExportOptions.FormatType = crEFTHTML40
    Report.ExportOptions.HTMLFileName = mstrWorkingDirectory & "\ClaimProductionByProcessorByDateByType.html"
    Report.DiscardSavedData
    Report.ParameterFields(1).AddCurrentValue (mdtmReportDate)
    Report.EnableParameterPrompting = False
    Report.Export False
        
    Set crxApplication = Nothing
    Set Report = Nothing
    Me.MousePointer = vbDefault


When i dont send the parameter mdtmReportDate it doesn't show me any error and the reports get generated without the parameter.

Could you please let me know how to handle this error?? i want it to come to error handler showing me parameter missing or atlease an error..


Also, if anyone can think of any errors that may occur while exporting to the crystal reports will be really helpful.

thanks in advance
Posted

1 solution

I dont know how you would achieve it programmitically, but if you think it this way.

Set a default value to the parameter in the report (i think you can do that).
So every time this report runs, put a condition and compare the value of your parameter with the default parameter in the report.

This is where you will know if at all any parameter is even getting passed before the report prints.

If condition fails, dont print the report, else carry on.

Hope this gives some direction and not misdirect you.

Thanks
Maz
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900