Error message on screen

  • Thread starter Thread starter KimTong via AccessMonster.com
  • Start date Start date
K

KimTong via AccessMonster.com

HI,

I have a simple question. How can I print an Error message on screen when the
user enter the wrong data? I prefer to use a VB script. Is anyone can help me?
.. Thank you in advance.

KF
 
Kim,
I assume your using a Form to enter the data... and NOT entering data
directly in the table.
Upon some condition (which determines a data entry error), use a Msgbox
to display the error information to the user.

For example, a text control (txtSomeField) value on a form must be less
than 100, and... using the BeforeUpdate event...

Private Sub SomeNumField_BeforeUpdate(Cancel as Integer)
If SomeNumField > 100 Then
Beep
MsgBox "Entry must be < 100"
Cancel = True
txtSomeNumField.Undo
End If
End Sub
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html
"Find a job that you love... and you'll never work a day in your life."
 
KimTong via AccessMonster.com said:
HI,

I have a simple question. How can I print an Error message on screen when
the
user enter the wrong data? I prefer to use a VB script. Is anyone can help
me?
Thank you in advance.

KF

Use the MsgBox function:

MsgBox "Your message here", options, "Title"

This would probably go in the AfterUpdate event of whichever control you're
wanting to test. In that event, check the entered value and, if there's a
problem, use MsgBox to inform the user.

Look in Access help for more information on MsgBox.

Carl Rapson
 
It works great, thank you..


Carl said:
[quoted text clipped - 5 lines]

Use the MsgBox function:

MsgBox "Your message here", options, "Title"

This would probably go in the AfterUpdate event of whichever control you're
wanting to test. In that event, check the entered value and, if there's a
problem, use MsgBox to inform the user.

Look in Access help for more information on MsgBox.

Carl Rapson
 
Back
Top