DELETE query not working

  • Thread starter Thread starter Usommer
  • Start date Start date
U

Usommer

Hi,

I try to make a delete query work and I don't know what
is wrong.

The query contains two tables., and I want to delete data
from one table, depending on a text string in the other
table.

It does not work, the error message that I get is

"Could not delete from specified tables" when I use
DELETE [tablename].[*]
or "specify the table containing the recorsd you want to
delete" when I use
DELETE [tablename].[fieldname]

When I use only pne zable and specify the text string I
want to look for in the WHERE clause it works OK.

Here is the query:

DELETE dbo_Appsoftware.*
FROM dbo_AppSoftware LEFT JOIN tbl_directory ON
dbo_AppSoftware.path Like "*" & tbl_Directory.Dirname
& "*"
WHERE tbl_Directory.Dirname Is Not Null;

Any Ideas?


Thanks.

Ulrich
 
I try to make a delete query work and I don't know what
is wrong.

First of all a DELETE statement is not a query. A query (by thesaurus) is
a question, enquiry, interrogation. DELETE is a data-manipulation-language
(DML) statement which is part of SQL but queries are only SELECT statements.
DELETE dbo_Appsoftware.*
FROM dbo_AppSoftware LEFT JOIN tbl_directory ON
dbo_AppSoftware.path Like "*" & tbl_Directory.Dirname
& "*"

Read up on the syntax of the delete command. there are no tokens allowed
between DELETE and FROM:

DELETE FROM <table> WHERE <conditions>

Note that there can be only one table in the statement. Of course the
conditions might have sub-queries invoking other tables...

AH
:)
 
André
First of all a DELETE statement is not a query. A query (by thesaurus) is
a question, enquiry, interrogation. DELETE is a data-manipulation-language
(DML) statement which is part of SQL but queries are only SELECT
statements.

Undoubtedly technically correct. In the Access UI, however, there are a
number of query "types" indicated, include the "action" (DELETE, UPDATE,
APPEND) type.
Read up on the syntax of the delete command. there are no tokens allowed
between DELETE and FROM:

Alternatively, use the Access query design grid and have Access create the
correct syntax.

Regards

Jeff Boyce
<Access MVP>
 
Back
Top