Solved

Msgbox Error

Posted on 2006-11-13
4
641 Views
Last Modified: 2008-03-03
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
0
Comment
Question by:billcute
  • 3
4 Comments
 
LVL 65

Accepted Solution

by:
rockiroads earned 500 total points
ID: 17928911
bill, if u want to see buttons, its the 2nd parameter to msgbox

what u have done is appended it to the first

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

should be

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


0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17928916
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"


0
 
LVL 4

Author Comment

by:billcute
ID: 17928952
Thanks..your answer resolved the problem..

Regards
Bill
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17928964
No probs
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Access 2016 - query 23 56
Access 2016 - Blank, Null, or empty string? 9 31
Passing variables to a function 6 33
Need to Populate a MS Access Table via VBA Code 3 22
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now