473,396 Members | 1,814 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,396 software developers and data experts.

Turn Off Default Validation Error Messages

Hello'

I have a field in which I require validation in a before update
event.
The validation code I have works fine, no problem there.

However I would like to turn off the default validation error
message...as it shows up in addition to the message I am providing.

For some reason, (SetWarnings = False) does not apply to this error...
Error: "The value in the field or record violates the validation rule
for the record or field..."

Here is my code;

Private Sub txtSample_BeforeUpdate(Cancel As Integer)
SetWarnings = False

Me.txtSample.BackColor = 16777215

Dim varReturnValue As Variant

varReturnValue = DLookup(Me!txtSample, "tblResults", "[Sample] =
" & Chr$(34) & Me! txtSample & Chr$(34))

If Not IsNull(varReturnValue) Then

MsgBox "This Sample # is already allocated, please input a
different sample number. If you would like to edit the entered sample
#, please use the data review prompts from the main menu."

Cancel = True
End If
End Sub

I assumed that SetWarnings would remove this message but it does not.
Is there another Default messages function I am unaware of?

Thanks




Oct 17 '08 #1
2 6850
On Fri, 17 Oct 2008 10:27:41 -0700 (PDT), "ry***********@gmail.com"
<Ry***********@gmail.comwrote:

Read the default message carefully. It suggests there is a validation
rule, either at the table level or at the field level. Design the
underlying table and check it out.

-Tom.
Microsoft Access MVP

>Hello'

I have a field in which I require validation in a before update
event.
The validation code I have works fine, no problem there.

However I would like to turn off the default validation error
message...as it shows up in addition to the message I am providing.

For some reason, (SetWarnings = False) does not apply to this error...
Error: "The value in the field or record violates the validation rule
for the record or field..."

Here is my code;

Private Sub txtSample_BeforeUpdate(Cancel As Integer)
SetWarnings = False

Me.txtSample.BackColor = 16777215

Dim varReturnValue As Variant

varReturnValue = DLookup(Me!txtSample, "tblResults", "[Sample] =
" & Chr$(34) & Me! txtSample & Chr$(34))

If Not IsNull(varReturnValue) Then

MsgBox "This Sample # is already allocated, please input a
different sample number. If you would like to edit the entered sample
#, please use the data review prompts from the main menu."

Cancel = True
End If
End Sub

I assumed that SetWarnings would remove this message but it does not.
Is there another Default messages function I am unaware of?

Thanks




Oct 20 '08 #2
"ry***********@gmail.com" <Ry***********@gmail.comwrote:
>However I would like to turn off the default validation error
message...as it shows up in addition to the message I am providing.

For some reason, (SetWarnings = False) does not apply to this error...
Error: "The value in the field or record violates the validation rule
for the record or field..."
That's not a warning message. That's an error message. It is also happening
outside your code and is happening when Access is attempting to save the record.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Oct 21 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: joes | last post by:
Hello I am using tomcat 3.3.1 for an intranet application with other third party software. Unfortunately I have to remove from the web.xml the web-app valiadtion, because of the old third party...
3
by: Rob Meade | last post by:
Hi all, I have a login page which has username and password fields, a login button, and 2 validation controls (one for each field) - currently I have controls to display to the summary if the...
2
by: Ely | last post by:
When validating a control client side, is there a way to get the error message to display in the validation summary as soon as the control losses focus? Right now it only displays when the user...
2
by: ticars | last post by:
I have a telephone number user control in which I need to validate the data entered (Required field validation and regular expression validation). The phone number is represented as 3 text boxes...
2
by: FayeC | last post by:
Can anybody point me to a good tutorial/manual on advanced server-side form validation including validation of fields against unwanted strings such as the use of "http://". Thank you in advance,...
4
by: Gregc. | last post by:
Hi Would someone have a basic example of form validation that validates name and address, but using only one alert box that displays which fields haven't been completed? I can do it on an...
3
by: Beemer Biker | last post by:
I started seeing huge amounts of error messages such as "Validation (XHTML 1.0 Transitional):" Element schema is not supported". There was nothing wrong with that for 3 weeks and suddenly there...
9
by: mstilli | last post by:
Hi, I am trying to use schema for server side validation using xerces to catch the validation errors. validating this XML: <Content4> <textarea13></textarea13>...
0
Motoma
by: Motoma | last post by:
Debugging messages are a powerful tool; however, many production systems (and test systems for that matter) have them disabled by default. If your PHP script is crashing horribly and you are not...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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
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...
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.