473,396 Members | 1,968 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.

How to trap error when referential integrity is violated?

I use db.execute to run a delete query. I've also tried DoCmd.OpenQuery.
Both work fine, but neither appears to allow me to trap an error if
referential integrity is violated - in which case no changes are made to the
table, but it would be nice to provide the user with a friendly message
telling him he's doing something wrong. I've thought about doing a DCount,
but that's too much overhead.

Is it possible to trap an error when table constraints prevent a delete
query from deleting?
Nov 13 '05 #1
2 1861
Use .Execute with the dbFailOnError option.

On Mon, 03 Jan 2005 02:00:52 GMT, "deko"
<www.clearpointsystems.com@use_contact_form.com> wrote:
I use db.execute to run a delete query. I've also tried DoCmd.OpenQuery.
Both work fine, but neither appears to allow me to trap an error if
referential integrity is violated - in which case no changes are made to the
table, but it would be nice to provide the user with a friendly message
telling him he's doing something wrong. I've thought about doing a DCount,
but that's too much overhead.

Is it possible to trap an error when table constraints prevent a delete
query from deleting?


Nov 13 '05 #2
> Use .Execute with the dbFailOnError option.

I love simple solutions.... Thanks!
Nov 13 '05 #3

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

Similar topics

1
by: yacht | last post by:
Is it bug? CREATE TABLE base ( base INT PRIMARY KEY ); CREATE TABLE child ( val INT ) INHERITS ( base ); CREATE TABLE ref ( atr INT , base INT REFERENCES base ON UPDATE cascade ON DELETE...
0
by: Sharon Cowling | last post by:
Hi, my problem is this: I have a table called faps_key the unique identifier being key_code: taupo=# \d faps_key Table "faps_key" Column | Type | Modifiers...
0
by: Steve | last post by:
In AccessXP in Access2000 mode --- TblCustomer: CustomerID, CustomerName TblOrder: OrderID, CustomerID, OrderDate TblOrderDetail: OrderDetailID, OrderID, Detail Appropriate...
3
by: Dave | last post by:
I have always taken it for granted that once RI is in place, no orphan records can be created, and that RI can't be put in place while orphans exist, but today I came across a situation where that...
1
by: Grant McLean | last post by:
Hi First a simple question ... I have a table "access_log" that has foreign keys "app_id" and "app_user_id" that reference the "application_type" and "app_user" tables. When I insert into...
7
by: Jimmie H. Apsey | last post by:
Referential Integrity on one of our production tables seems to have been lost. I am running Postgres 7.1.3 embedded within Red Hat kernel-2.4.9-e.49. Within that I have a table with referential...
3
by: moskie | last post by:
Is there a way to run an alter table statement that adds a constraint for a foreign key, but does *not* check the existing data for refrential integrity? I'm essentially looking for the equivalent...
3
by: Wayne | last post by:
I've inadvertently placed this post in another similar newgroup, and I apologise if you get it twice. I'm building a database that consists of frontend and backend. Some of the lookup tables...
2
by: ApexData | last post by:
Access2000, using a continuous form. I’m getting a message that say “you cannot add or change a record because a related record is required in table Employee”. This occurs in all my combobox...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
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
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
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.