how can I display a custom error prompt?

  • Thread starter Thread starter Kelvin Beaton
  • Start date Start date
K

Kelvin Beaton

I have a form that has required fields... How can I display a message that
says something like, "You must enter a city, state and zip code"?

I'm not much of a coder, but if someone can give me an example, I can
usually figure it out....

Thanks in advance!

Kelvin
 
Hi

The basics are that you can display a message box on many events (on even
non-events) on a form, like this

MsgBox "Some message here", vbOKOnly, "Message title"

So if you ant to display the message after controlABC on a form has lost the
focus you can use something like
Private Sub controlABC1_LostFocus()
MsgBox "Some message here", vbOKOnly, "Message title"
End Sub

This is not much so you could include the criteria that if the control has
the value of 123 only then should the message be displayed. Like this
Private Sub controlABC1_LostFocus()
If Me.contolABC = 123
MsgBox "Some message here", vbOKOnly, "Message title"
End If
End Sub

You can add a cancel option to the message box - Cancel - Continue. You can
display the box if the incorrect value is entered in "another" control or the
sum of other controls adds up to XYZ, etc, etc etc.

There are so many option that if would be better if you gave a specific
question and someone will be able to offer more detailed answer

Hope this helps
 
On the control properties, on the data tab,
put something into the 'validation rule'
and into the 'validation text' properties

(david)
 
Back
Top