indoaryaan
IS-IT--Management
I use the following VB function as embedded code in SQL reporting to generate a message box if the date entered is NOT Monday. The message box pops up fine when the date is NOT Monday. The report spans 90 pages(group inserted with page break) and I have to click the message box (vbOkCancel) 90 times before the report shows. I guess for every page rendered, message box pops up once. How I do stop the message box showing up repeatedly? If I click Cancel, the cursor should go back to the parameter text box on the report prompting the user to enter the date again.
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 in advance.
Indoaryaan.
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 in advance.
Indoaryaan.