By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,601 Members | 989 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,601 IT Pros & Developers. It's quick & easy.

Help with numeric field, msgbox

P: n/a
I am looking for a technique with regards to the message displayed
when you enter text into a numeric field. I obviously get the "The
value entered isn't valid for this field" message how do I substitute
this message for my own? I have tried before update (if
notisnumeric(myfield.text), keydown. But I can not get it to wok,
thanks in advance!

Mar 10 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Mar 10, 1:02 pm, r...@si.rr.com wrote:
I am looking for a technique with regards to the message displayed
when you enter text into a numeric field. I obviously get the "The
value entered isn't valid for this field" message how do I substitute
this message for my own? I have tried before update (if
notisnumeric(myfield.text), keydown. But I can not get it to wok,
thanks in advance!

I usually use the BeforeUpdate event. I think your example is written
wrong..
if notisnumeric(myfield.text)

should read

If Not IsNumeric(Me!myfield.Text) Then
Msgbox "That's not a number dummy!"
Cancel = True
End If

Also remember to check if the field is null or if necessary, some
other value that may also be a number - like True and False.

Mar 10 '07 #2

P: n/a
On 10 Mar 2007 10:02:43 -0800, rz***@si.rr.com wrote:
I am looking for a technique with regards to the message displayed
when you enter text into a numeric field. I obviously get the "The
value entered isn't valid for this field" message how do I substitute
this message for my own? I have tried before update (if
notisnumeric(myfield.text), keydown. But I can not get it to wok,
thanks in advance!
Here's how you can find the correct error and show your own message
for any of the form level errors.

First code the Form's Error event:

MsgBox "Error#: " & DataErr ' Display the error number
Response = acDataErrDisplay ' Display Default message

Then open the form and intentionally make that error.

The message box will display the error number and the default error
message.

Next, go back to the error event and change that code to:

If DataErr = XXXX Then
Response = acDataErrContinue ' Don't display the default message
MsgBox "Please enter a number only."
Else
MsgBox "Error#: " & DataErr
Response = acDataErrDisplay ' Display Default message
End If

where XXXX is the error number.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Mar 10 '07 #3

P: n/a

fredg , pretty cleaver, I tried to sniff out the error to trap with
the Msgbox err.number but it was returning 0, thanks I can use the
same for required fields as well!
Mar 12 '07 #4

P: n/a
On 10 Mar 2007 10:02:43 -0800, rz***@si.rr.com wrote:
I am looking for a technique with regards to the message displayed
when you enter text into a numeric field. I obviously get the "The
value entered isn't valid for this field" message how do I substitute
this message for my own? I have tried before update (if
notisnumeric(myfield.text), keydown. But I can not get it to wok,
thanks in advance!
Here's how you can find the correct error and show your own message
for any of the form level errors.

First code the Form's Error event:

MsgBox "Error#: " & DataErr ' Display the error number
Response = acDataErrDisplay ' Display Default message

Then open the form and intentionally make that error.

The message box will display the error number and the default error
message.

Next, go back to the error event and change that code to:

If DataErr = XXXX Then
Response = acDataErrContinue ' Don't display the default message
MsgBox "Please enter data in all required fields."
Else
MsgBox "Error#: " & DataErr
Response = acDataErrDisplay ' Display Default message
End If

where XXXX is the error number.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Apr 8 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.