Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Message Box

Status
Not open for further replies.

indoaryaan

IS-IT--Management
Nov 19, 2003
26
0
0
US
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top