Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Access Query


Message #1 by "Mark Irvine" <mark@m...> on Wed, 15 Aug 2001 12:58:24
Hi,



I used the Query Builder to build this query:



DELETE client_details.*, client.*, client_details.fkClient_ID

FROM client INNER JOIN client_details ON client.Client_ID = 

client_details.fkClient_ID

WHERE (((client_details.fkClient_ID)=82));



When ever I view it using 'Datasheet' view all affected records are 

displayed.  However when I try to run the query, an error is generated:



"Could not delete from specified tables." (Error 3086)



The database is being run locally and is NOT open in Read-Only mode.  Can 

anyone help?  Will this approach even work or should I run two queries one 

deleting from client and one deleting from client_details



Mark
Message #2 by "Pardee, Roy E" <roy.e.pardee@l...> on Wed, 15 Aug 2001 07:09:47 -0700
Rather than try to delete from both tables in a single query (I think that's

what you're going for anyway) try one of the following:



- Use two separate queries--first delete from client_details and then delete

from client

- If you've got a relationship set up between client and client_details,

turn on cascading deletes (double-click the line representing the

relationship & check the 'cascade delete related records' box).  Then change

your delete query to only delete from client & the client_details recs will

also be deleted automatically.



The second suggestion will only work if you don't have further relationships

'downstream' of client_details, which don't also have cascading deletes

enabled.  It's also worth taking some time to think about whether you really

want to turn the cascading delete feature on--it does lose you some

protection against inadvertant deletes.



HTH,



-Roy



-----Original Message-----

From: Mark Irvine [mailto:mark@m...]

Sent: Wednesday, August 15, 2001 5:57 AM

To: Access

Subject: [access] Access Query





Hi,



I used the Query Builder to build this query:



DELETE client_details.*, client.*, client_details.fkClient_ID

FROM client INNER JOIN client_details ON client.Client_ID = 

client_details.fkClient_ID

WHERE (((client_details.fkClient_ID)=82));



When ever I view it using 'Datasheet' view all affected records are 

displayed.  However when I try to run the query, an error is generated:



"Could not delete from specified tables." (Error 3086)



The database is being run locally and is NOT open in Read-Only mode.  Can 

anyone help?  Will this approach even work or should I run two queries one 

deleting from client and one deleting from client_details



Mark

Message #3 by "Mark Irvine" <mark@m...> on Wed, 15 Aug 2001 15:40:53
Roy,



Many thanks for your suggestion.  There was already a relationship between 

the two table.  As these are the only two table in the database, I decided 

to go with you second suggestion and check the 'Cascade Delete Related 

Records' option.



Again many thanks,



Mark

  Return to Index