472,954 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,954 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 6779
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.