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

Replacing default error message (duplicate index 3022) with a custom one

15
I assigned index on two table fields:
[orderID]
[CurrencyName]

The following code is to trap a duplicate index and replace default error message with a custom one.
PROBLEM: Although my custom error message appears, the default one also shows up.

Private Sub Form_Error(DataErr As Integer, Response As Integer)
Expand|Select|Wrap|Line Numbers
  1. Select Case 
  2. 'code here
  3.  Case DataErr = 3022 ‘ duplicate index error
  4.     MsgBox "My custome error message", vbOKOnly + vbExclamation, stMsgTitle            
  5.     Response = acDataErrContinue
  6.  End Select
  7. 'code here
  8. End Sub
  9.  
Shouldn’t
Expand|Select|Wrap|Line Numbers
  1. Response = acDataErrContinue
disable default error message?
How should be the code modified to prevent default error from displaying?

Thank you for hints.
Jan 8 '15 #1

✓ answered by Seth Schrock


2 2381
Seth Schrock
2,965 Expert 2GB
Check out Custome Error Messages
Jan 8 '15 #2
twinnyfo
3,653 Expert Mod 2GB
Try This:

Expand|Select|Wrap|Line Numbers
  1. DoCmd.SetWarnings False
before your code and
Expand|Select|Wrap|Line Numbers
  1. DoCmd.SetWarnings True
after your code.
Jan 8 '15 #3

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

Similar topics

3
by: Rolan | last post by:
I seem to be unable to have a custom error message to appear for Error 10011 (database was unable to append all the data to the table). Each time, the MS Access default error message box appears....
8
by: pmud | last post by:
Hi, I am using a compare validator in asp.net application(c# code). This Custom validator is used for comparing a value enterd by the user against the primary key in the SQL database. IF the...
2
by: Aaron | last post by:
how can i configure asp.net so that whenever an error occurs it would show a blank page, not the default error message. Thanks.
2
by: c676228 | last post by:
Hi, I have several user controls like email, phone,ssn etc. each has it's own validation message in its user control already. When I bring all those user controls in an aspx page, I would like to...
8
by: g_man | last post by:
I am trying trap Runtime error 3022 (duplicates) in the click event of a command button that closes the form. I have code in the Form_Error event that does a good job of providing a more meaningful...
2
by: Sugan | last post by:
Hi All, I have a peculiar kind of issue after converting VC and VB code from Visual studio 6.0 to Visual Studio 2005. We have the business logic in the VC code which uses the ATL framework...
0
by: Sugan | last post by:
Hi All, I have a peculiar kind of issue after converting VC and VB code from Visual studio 6.0 to Visual Studio 2005. We have the business logic in the VC code which uses the ATL framework...
8
by: zyzolus | last post by:
Hello, I create 2 unique indexes on 2 fields: Field1 and Field2. What is the way generate custom error message independent of each field?ex.: "Duplicate value in Field1" or "Duplicate value...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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
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
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...

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.