Monday, February 20, 2012

Message Box In Reporting services

Hello,

I am using sql reporting services 2000. I have tried to put a message box in my reports using a VB function. If the report contains 10 pages, the message box pops up 10 times. What do i need to do to make the message box pop up only once during the start of the report? Also, if I click CANCEL(vbOkCancel), the cursor should go back to the parameter box prompting me to enter a parameter again. In this case, I enter a date and check whether it is a MONDAY or not. VB function is as below...

Function CheckDay(ByVal S As DateTime) As Integer
Dim GivenDate as Date
Dim GivenDay as Integer
Dim intMsg as Integer
GivenDate = S
GivenDay = WeekDay(GivenDate)
If NOT GivenDay = 2
intMsg = MsgBox("The selected day is not a Monday", VbOKCancel, "The selected date is not a Monday.")
End IF

Return GivenDay
End Function

Thanks......

I recommend to use the ReportViewer control (www.gotreportviewer.com) of VS 2005 instead and build your own parameter user interface to perform the validation. Once, the validation succeeds, you would use the ReportViewer control to display the report.

The approach you are currently trying won't work. Also keep in mind that the message box pop up will only work when running that report in preview. It won't work for reports deployed on a report server.

-- Robert

No comments:

Post a Comment