Error message on screen

  • Thread starter KimTong via AccessMonster.com
  • 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
 
A

Al Campagna

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."
 
C

Carl Rapson

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
 
K

KimTong via AccessMonster.com

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top