Message Box Not Visible

  • Thread starter Thread starter Neil Clark
  • Start date Start date
N

Neil Clark

I have a pop-up form that is used to enter a new record.
There is a "Done" button that is used to close the form. I
then have a number of pieces of code that are fired by the
done button (before it is allowed to close the form) to
check if certain fields have been filled in correctly. For
example, the first such code snippet is:

---------------------------
If IsNull(CandState) And CandCountry = "Australia" Then
DoCmd.Beep
CandState.SetFocus
msgbox ("For an Australian Candidate, the State is a
Mandatory field." & vbCr & "Please enter the Candidate
State.")
Exit Sub
End If
---------------------------

There are several others with the same structure as this
one - they check other fields.

The problem is that the messages boxes do not appear when
the code fires. In the above example, there IS a "beep"
and the focus DOES go to the CandState field, but the
message box is not evident on the screen. Consequently the
users don't know what the system is asking for.

Does anyone have any ideas on why this is happening?
 
Neil,
I've tried to repro it and I can't seem to. It is working for me at the
moment. Just out of curiosity, and this may seem like a very dumb question,
but did you copy/paste your code EXACTLY as it was below?
In my test case I have a form with a button that lanches a popup form with 2
text fields and a button, the button verifyer is as below:

Private Sub testfocus()
If IsNull(CAndState) And CAndCountry = "Australia" Then
DoCmd.Beep
CAndState.SetFocus
MsgBox ("For an Australian Candidate, the State is a Mandatory
field." & vbCr & "Please enter the Candidate State.")
Exit Sub
End If
End Sub

Does that sound like what you're doing or am I missing a step in there
somewhere? Let me know any other info you can.
 
Back
Top