473,406 Members | 2,956 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,406 software developers and data experts.

invalid data entry

mseo
181 100+
hi,
I have a form within access 2003 database
this form contain a textbox assigned for entering the hire date (date/time)
but when I enter a text entry to this field by mistake I get a prompt that the data you entered isn't valid for this field
the point is how can i handle this using vba code
thank you for any help you may provide me.
Nov 17 '09 #1

✓ answered by ChipR

Here's an example I copied from somewhere that you can alter or add to to suit your needs. You may have to search for the appropriate integer for the error you are trying to handle.

Expand|Select|Wrap|Line Numbers
  1. 'This changes the Input Mask default message******************
  2. Private Sub Form_Error(DataErr As Integer, Response As Integer)
  3.   Const INPUTMASK_VIOLATION = 2279
  4.   If DataErr = INPUTMASK_VIOLATION Then
  5.     MsgBox "Invalid input."
  6.     Response = acDataErrContinue
  7.   End If
  8. End Sub

7 3410
ChipR
1,287 Expert 1GB
Here's an example I copied from somewhere that you can alter or add to to suit your needs. You may have to search for the appropriate integer for the error you are trying to handle.

Expand|Select|Wrap|Line Numbers
  1. 'This changes the Input Mask default message******************
  2. Private Sub Form_Error(DataErr As Integer, Response As Integer)
  3.   Const INPUTMASK_VIOLATION = 2279
  4.   If DataErr = INPUTMASK_VIOLATION Then
  5.     MsgBox "Invalid input."
  6.     Response = acDataErrContinue
  7.   End If
  8. End Sub
Nov 17 '09 #2
NeoPa
32,556 Expert Mod 16PB
How do you want it to be handled. That's not a very clear indication of what you want. Please try to explain what you mean.
Nov 18 '09 #3
missinglinq
3,532 Expert 2GB
The error for this is 2113, so use that in place of the 2279 in Chip's code, assuming that Chip has the right idea and you just want to have a more user-friendly error message. If your need is for something else, then you'll have to give us a more detailed explanation of what you want to do, as NeoPa said.

Linq ;0)>
Nov 18 '09 #4
mseo
181 100+
hi,
this code is running good for this kind of errors
but when I enter a text entry to numeric field the msgbox appears for the user "invalid input" , but the entry I enter to the field still in the field
I just want to handle this as you provided me but I need one more step to make the form user-friendly this step is when i click on the ok button in the msgbox i want the input i inserted to be removed out of the field
thank you all
Nov 19 '09 #5
ChipR
1,287 Expert 1GB
From a user-friendly perspective, I'm not so sure you want to just wipe out the input. Consistency is key for a friendly interface, and most programs we use will hilight the error so that it can be fixed rather than delete it.
Nov 19 '09 #6
NeoPa
32,556 Expert Mod 16PB
That's very good advice from Chip. I would give that serious consideration.
Nov 19 '09 #7
mseo
181 100+
thanks
I meant not to delete the input but let's assume that the user entered a text in numeric field error msgbox will be appeared for him, and when the user click ok in this msgbox the text he had entered would be in the field so i just want: when the user insert a text in numeric field get a msgbox and when click ok wipe out the the text that the user inserted
i need to do so because what a bout if the user click exit without adding any new record he will get error msg but if i wiped it out the user wouldn't get any type of error
thanks for advice ChipR
Nov 20 '09 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Todd | last post by:
Our ASP.NET (C#) application accepts form entry and saves inputed data in XML. We are finding that users are sometimes cutting and pasting special characters (from MS Word) into these forms....
4
by: deko | last post by:
RE: "Object Invalid or No Longer Set" errors I've had an angelic visitation and the revelation is that my problem, in essence, is due to the fact that I have multiple forms open at the same time...
10
by: jeff regoord | last post by:
A user inputs a float value. The scanf() function gets the value. However, I need to create an error handler with an if else statement saying invalid input if the input is not a number. Does...
11
by: tomrmgc | last post by:
I have a dll that was working in VC6, but isn't loading after being built in VC71. LoadLibrary() returns null and the error code (from GetLastError()) is -2147483645 "One or more arguments are...
2
by: Dabbler | last post by:
In my Registrant FormView I have a DropDownList which loads data from a secondary SqlDataSource "sdsOfficeParks". I need the user to select an office park but save the selected value in the...
2
by: sree reddy | last post by:
..cs using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls;
1
by: admin.offshoredataentry | last post by:
Data Entry Outsourcing provides time bound, cost effective and qualitative Data Entry also provides numeric data entry, textual data entry, image data entry, data format, data conversion and also...
1
by: Data Entry Outsourcing | last post by:
Data Entry plays vital role in every business area. Data Entry is one such aspects of any business that needs to be handled properly for expanding your business. Data Entry is one of the leading...
2
by: eruss21 | last post by:
Here's my code. Don't know what's going on. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using...
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?
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
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,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
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...
0
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,...

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.