Link to home
Start Free TrialLog in
Avatar of billcute
billcute

asked on

Msgbox Error

The function below checks to see if information pertaining to last quarter schedules were filled, if missing
a msgbox pops from an "On Open Event handler..

Everything works fine except that the last line of the msgbox adds "zero" to the end of the message.
.....this line...code adds zero when the message actually displays to user

'-->> It reads "Please contact your Administrator.0   '<<<---


Here is the "On Open Event handler code"

' .............................
' ............................
    'Check if filing date entered for relevant quarter
    rptFiled = checkFilingDate(qtrNum, yrNum)
   
    ' if no filing date and not in grace period
    If rptFiled = False And notifPeriod = False Then
        MsgBox "You cannot proceed as no filing date has been entered" & vbCrLf & _
               "for quarter " & qtrNum & " " & yrNum & "." & vbCrLf & _
               "Please contact your administrator." & vbOKOnly
       
        DoCmd.Close
' ..............................
' ..............................

' **********
Function checkFilingDate(qtr As Integer, yr As Integer) As Boolean
' function to check if a date has been entered in the relevant quarter

If Nz(DLookup("[DateFiled]", "tblFilingDates", "[QtrNo]=" & qtr & " And [YearNum]=" & yr), "") = "" Then
        checkFilingDate = False
    Else
        checkFilingDate = True
    End If

End Function
ASKER CERTIFIED SOLUTION
Avatar of rockiroads
rockiroads
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
U can add icons to the 2nd parameter and a third parameter also, a title for your msgbox


MsgBox "You cannot proceed as no filing date has been entered" & vbCrLf & _
               "for quarter " & qtrNum & " " & yrNum & "." & vbCrLf & _
               "Please contact your administrator." , vbOKOnly + vbExclamation, "Ooops"


here we display exclamation mark in the msgbox with a title captiond "Ooops"


Avatar of billcute
billcute

ASKER

Thanks..your answer resolved the problem..

Regards
Bill
No probs