Re: I don't understand why this Delete Query fails?
- From: John Spencer <spencer@xxxxxxxxxx>
- Date: Sat, 23 Aug 2008 21:50:56 -0400
Delete the relevant records from StreetNames
DELETE
FROM tbl_Street_Names
WHERE tbl_Street_Names.StreetNameID In
(SELECT StreetNameID
FROM [tbl_EC_Postcodes_not_used_in_Waypoints but_exist in_Street_Names)
Sometimes you can use DISTINCTROW to achieve the desired result, but usually that fails
DELETE DISTINCTROW tbl_Street_Names.*
FROM [tbl_EC_Postcodes_not_used_in_Waypoints but_exist in_Street_Names]
INNER JOIN tbl_Street_Names ON [tbl_EC_Postcodes_not_used_in_Waypoints
but_exist in_Street_Names].StreetNameID = tbl_Street_Names.StreetNameID;
'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
efandango wrote:
I am trying to delete some records from one table with matching [StreetNameID] in another table, but when I try and run the delete query, i get an error:.
'Could not delete from specified tables'. when I hit the help button for an explanation; I get this:
You tried to delete data from one or more tables, but the deletion could not be completed.
Possible causes:
You do not have permission to modify the table. To change your permissions assignments, see your system administrator or the table's creator. The database was opened for read-only access. The database is read-only for one of these reasons:
You used the OpenDatabase method and opened the database for read-only access. The database file is defined as read-only in the database server operating system or by your network. In a network environment, you do not have write privileges for the database file. In Microsoft Visual Basic, you used the Data control and set the ReadOnly property to True.
To delete the data, close the database, resolve the read-only condition, and then reopen the file for read/write access.
This is my query SQL:
DELETE tbl_Street_Names.*
FROM [tbl_EC_Postcodes_not_used_in_Waypoints but_exist in_Street_Names] INNER JOIN tbl_Street_Names ON [tbl_EC_Postcodes_not_used_in_Waypoints but_exist in_Street_Names].StreetNameID = tbl_Street_Names.StreetNameID;
- Follow-Ups:
- Re: I don't understand why this Delete Query fails?
- From: efandango
- Re: I don't understand why this Delete Query fails?
- References:
- I don't understand why this Delete Query fails?
- From: efandango
- I don't understand why this Delete Query fails?
- Prev by Date: Re: Exclude fields after SELECT *
- Next by Date: Re: Non-updateable query issue
- Previous by thread: Re: I don't understand why this Delete Query fails?
- Next by thread: Re: I don't understand why this Delete Query fails?
- Index(es):
Relevant Pages
|