Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with a Delete Query

Status
Not open for further replies.
Jul 5, 2001
40
0
0
US
I have the following Table:

DELETE [Details - Expenses (Check Detail)].*, [Details - Expenses].CompanyID
FROM [Details - Expenses (Check Detail)] LEFT JOIN [Details - Expenses] ON [Details - Expenses (Check Detail)].CheckNumber = [Details - Expenses].CheckNumber
WHERE ((([Details - Expenses].CompanyID) Like [Forms]![LIST OF NAMES - Edit Vendor-Contributor Name]![CompanyID]));

Whenever I try to run the query I get the follwing error:

Could not delete from specified tables. (Error 3086)

Here is what I am trying to accomplish:

I have a table which contains check information: Date, check number, description of the check and check amount).

Below this is another table which conains the following:
Check number, detail, detail amount

I have created a delete query and am trying to delete the detail based on a query. The query checks the company ID to make sure there is a match. Then I have 1 - 1 relation ship with this other table, which assigns all the check numbers. The query I am trying to build then uses that information to delete all check details.

I hope this isn't confusing but any help would be appreciated.

Thanks
 
Two options:

1. Use two DELETE queries - delete the records in the detail table first, then the records in the check information table.

OR

2. Set the relationship between the two tables to cascade deletes - then just delete the records in the check information table with one DELETE query and the deletion will be cascaded down to the detail table.

Personally, I'd go for the 2nd of these options. [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top