473,657 Members | 2,407 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(my field.text), keydown. But I can not get it to wok,
thanks in advance!

Mar 10 '07 #1
4 3171
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(my field.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(my field.text)

should read

If Not IsNumeric(Me!my field.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(my field.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 = acDataErrDispla y ' 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 = acDataErrContin ue ' Don't display the default message
MsgBox "Please enter a number only."
Else
MsgBox "Error#: " & DataErr
Response = acDataErrDispla y ' 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(my field.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 = acDataErrDispla y ' 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 = acDataErrContin ue ' Don't display the default message
MsgBox "Please enter data in all required fields."
Else
MsgBox "Error#: " & DataErr
Response = acDataErrDispla y ' 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
2306
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 on txtqtrlabel and txtqtrlabel2. I have a main form based on tblmonth which has a subform based on tblmain, the two forms are also linked on the same fields. The data entered into txtmonth could be "30/09/04" and the txtqtrlabel data would be...
1
1510
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 thinking I cna manage to get the 3rd on there with a little help from all of you. The objective is to open a report based on 3 values supplied in a form. Lemme know if you need more info. Here is the code and thanks in advance..... Private...
15
2958
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 it. Simple database: I want to have a user enter Supply Orders (just for tracking purposes) by Item. The user may also enter a new item - "new" is a combination of Item, PartNumber and Vendor - they could have the
11
2794
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 (strPubCity) for Publisher City. These two fields have a many-to-one relationship with tables, (tlkpPubName and tlkpPubCity) respectively. The lookup tables only have one field (strPubName and strPubCity), which is their primary key. I also have...
4
2715
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 accomplish this? T.I.A. Grant Try
8
1975
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 field. this is wat i've got so far; Private Sub FilmID_BeforeUpdate(Cancel As Integer) If DCount("*", "tblFilmRental", "FilmID=" & Me!) > 0 Then Cancel = True
2
1348
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 consists of a form with two text boxes that allow the user to enter numbers. These numbers will either be added, subtracted, divided or multiplied by each other. The user will type which operant that they wish to use by using an additional text boxed...
3
3332
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 side. I am trying to learn how to manipulate Dynamic Queries by forms via the example database: QrySampl.MDB, offered by Microsoft (as a learning tool, I suppose.) In particular, I am working with code from the example: "Query By Form (QBF) Using...
7
3880
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 anyone who submits anything to anywhere, actually... I'm having trouble with the Visual Basic code for the on click event of a button. So, I have a form, FormA, whose source is a query. On FormA, there is a numeric field called FieldA. FieldA...
0
8411
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8323
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8613
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7351
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.