How to Trap Cascade Delete Errors from Jet Engine 
Author Message
 How to Trap Cascade Delete Errors from Jet Engine

Hello Dave

I browsed this newsgroup and camed to your mail.

I also had this problem. I have a database with a table named Person where
I register adress information about persons. I also have a lot of tables
that are connected to this and like you, I wanted to know if a perticular
person had any connections before I deleted his/her record from the

Instead of detecting related records when I try to delete the record I have
included a subform in my form named "Person" where I display all current
connections. The data source for the subform is a union query:

SELECT  "Name of form - Table1" AS Table FROM Table1 WHERE PersID =
SELECT  "Name of form - Table2" AS Table FROM Table2 WHERE PersID =
SELECT .....and so on ....;

The primary key in my Person table i displayed in the control
Forms!Person!PersID and the forrein key in the other tables are all called
PersID. There shall be one UNION SELECT for each relation to your table.

This will list all your connections. If there is a connection to Table1 the
text "Name of form - Table1" will be displayed in the subform.

This is maybe not exactly what you were asking for and maybe a different
approch, but it works fine for me.

Hope this will be of some help
Lars Fransn

> I am looking for a way to tell wether there are any related records in
> other tables to the current record before I delete it.  If you do not
> have cascade delete turned on, the Jet Engine will stop you from deleting
> the
> current record if you have related records.  I need to be able to
> intercept that message from the Jet engine and execute some code, but it
> does not
> generate an error condition.  

> I am fairly good at writing code and am working on a routine that looks
> all the
> relationships via DAO and then checks each table for the current ID.  But
> if I could just trap
> the message from Jet engine, it would save a lot of time.

> Anybody got ideas? Thanks.

Thu, 11 Nov 1999 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Trapping Cascade Delete Error

2. trapping jet database engine errors

3. Cascading Delete Error - Need Help!

4. rst.delete, with cascade delete???

5. jet engine engine.idle

6. Jet engine displays error messages in Spanish-Help!


8. VB4 Jet Engine Runtime Error 3196

9. Jet Engine Error 3197 without Edit

10. List of Jet Engine Error Codes available?

11. Jet Database engine error.

12. Jet Engine Error Messages


Powered by phpBB® Forum Software