Report Parameter validation in ssrs report

后端 未结 3 585
一个人的身影
一个人的身影 2020-12-21 10:37

I have created one SSRS report having begin date and end date. If I provide end date< start date it will execute the report as shown in the image

3条回答
  •  难免孤独
    2020-12-21 11:31

    Click Report Menu then Report Properties.
    Go to Code Tab and add similar code as per your requirement:

    Function CheckDateParameters(StartDate as Date, EndDate as Date) as Integer
    Dim msg as String
         msg = ""
         If (StartDate > EndDate)  Then
     msg="Start Date should not be later than End Date"
         End If
         If msg <> "" Then 
     MsgBox(msg, 16, "Report Validation")
     Err.Raise(6,Report)                    'Raise an overflow
         End If
    End Function
    

    And

    Follow the Steps:

    1.) Go the Report Parameters and add a parameter with the datatype is string.

    2.) Check the Hidden checkbox and Allow blank value ckeckbox.

    3.) From Default Values choose Non-Queried radio button and then press the FX button and paste this code.

    =CODE.CheckDateParameters(.Value,.Value)
    

    Then press OK.

    See reference Link:

    Easy Step by Step SSRS Parameter Validation Using Code & Conditional DataSet

提交回复
热议问题