缺少参数时在Crystal报表中引发错误 [英] Raise error in Crystal report when parameter is missing

查看:91
本文介绍了缺少参数时在Crystal报表中引发错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我第一次在vb 6.0中使用Crystal Report 8.5.
实际上,我正在尝试查找所有可能出现的水晶报告中可能出现的错误.

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.

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



当我不发送参数mdtmReportDate时,它不会显示任何错误,并且会生成不带参数的报告.

您能否让我知道如何处理此错误?我希望它出现在错误处理程序中,向我显示参数丢失或出现错误..


另外,如果任何人都可以想到导出到Crystal报表时可能发生的任何错误,将非常有帮助.

在此先感谢



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

推荐答案

我不知道如何以编程方式实现它,但是如果您这样看.

将默认值设置为报表中的参数(我认为您可以做到).
因此,每次运行此报告时,都要放置一个条件,并将参数值与报告中的默认参数进行比较.

在这里,您将知道在打印报告之前是否甚至传递了任何参数.

如果条件失败,请不要打印报告,否则继续.

希望这能给您一些指导,不要误导您.

谢谢
马兹
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


这篇关于缺少参数时在Crystal报表中引发错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆