|
-
Feb 14th, 2008, 08:26 AM
#1
Thread Starter
Frenzied Member
Join and update the tables
I have two tables..and join the two tables 'A' and 'B' using Plot number field name. When I delete the Plot number in the tables 'A' Why the plot number still exits in the tables 'B' in Microsoft Access ? Why it cannot update?Any idea to solve this
-
Feb 14th, 2008, 10:53 AM
#2
Re: Join and update the tables
I can't remember off the top of my head whether Access allows you to specify that deletes should be cascaded on a foreign key. If it does then you need to set that to on.
I don't think it does though and that means you're going to have to handle this from your code. That shouldn't be difficult, whenever you issue a delete against table A you need to issue a similar delete against table B.
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
-
Feb 14th, 2008, 11:00 AM
#3
Re: Join and update the tables
You can set Access to Delete (or Update) on FK's (Cascade option). Personnaly I never use this option and always do this manually. If the FK was set properly to start with this would not happen (cascade is off by default) and the parent could not be deleted if a child is present
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Feb 14th, 2008, 11:35 AM
#4
Re: Join and update the tables
Generally I'd agree with Gary that you're probably safer to use the foreign key to refuse the delete instead of cascade it and then handle deletes in your code by deleting any child records first. This gives you much more control over what's happening in your database.
However, I have recently inherited a system from another company who control just about everything from within the database using triggers, sprocs etc. They made heavy use of foreign keys with a whole strategy surrounding enforcing integrity by both cascading or refusing deletes as apropriate. This works very well but does need alot of planning and documentation up front.
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|