473,394 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Help with numeric field, msgbox

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
4 3161
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
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

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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Tony Williams | last post by:
I have two tables 1.tblmonth which holds two fields txtmonth and txtqtrlabel and 2. tblmain which holds a number of fields but in particular a field called txtqtrlabel2. The two tables are linked...
1
by: mmethe | last post by:
The following snipplet produces "Data type mismatch in criteria expression". It must be someting simple. I will ultimately need this where condition to contain 3 clauses. I am posting it with 2...
15
by: sara | last post by:
Hi I'm pretty new to Access here (using Access 2000), and appreciate the help and instruction. I gave myself 2.5 hours to research online and help and try to get this one, and I am not getting...
11
by: my-wings | last post by:
I think I've painted myself into a corner, and I'm hoping someone can help me out. I have a table of books (tblBooks), which includes a field (strPubName) for Publisher Name and another field...
4
by: Grant | last post by:
I want to be able to accept a value in "goToTextBox.Text" if it is a decimal value such as 3.4. My Try statement currently catches non-numeric or blank data, which I want to retain. How can I...
8
by: DP | last post by:
hi, i've got a price of code, which checks to see if a film is on rent, or available. but how can i actualyl make the cancel button do somthing? because, the cursor gets stuck on the filmID...
2
by: hassruby | last post by:
Can someone pls help me with some validation that im having a few technical problems with in my program. First of all, I will explain to you a little about what my program is suppose to do. It...
3
by: mcmahonb | last post by:
Hey people... I've been searching this forum for a few hours and even though this topic has been went over from many different angles; I cannot seem to figure out how to make things work on my...
7
by: rik | last post by:
I am trying to build an Access 2002/2003 database application that I would like to offer to other writers so they can track submissions. Just trying to make a helpful tool for writers, poets, or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.