Delete query based on table and query

E

Eskimo

I have

tblGPSData
-------------
ID(Autonumber, PK)
TXDate(Date)
TXTime(Time)
PTT(Number)
FixNo(Number)
FixStatus(Text)
FixDate(Date)
FixTime(Time)
Longitude(Number)
Latitude(Number)

Query1
--------
SELECT GPSData.ID, GPSData.TXDate, GPSData.TXTime, GPSData.PTT,
GPSData.FixNo, GPSData.FixStatus, GPSData.FixDate, GPSData.FixTime,
GPSData.Longitude, GPSData.Latitude
FROM GPSData
WHERE (((GPSData.PTT)=18722) AND ((GPSData.FixNo)=1) AND
((GPSData.FixStatus)="Bad"));

Query2
--------
DELETE GPSData.*
FROM GPSData INNER JOIN Query1 ON (GPSData.PTT = Query1.PTT) AND
(GPSData.TXDate = Query1.TXDate) AND (GPSData.TXTime = Query1.TXTime);

Why does the Delete query not work? I get a message saying "cannot delete
from Specified Tables"

I am stumped on this. Could not find anything under search.

Eskimo
 
E

Eskimo

I Got it, thanks to Michel Welsh on another question

He wrote...
Hi,


to delete from one table over a join, you add DISTINCTROW:

DELETE DISTINCTROW tblAllDataMerged.*
FROM tblAllDataMerged INNER JOIN tblExcludedRecords
ON tblAllDataMerged.SSN = tblExcludedRecords.SSN;



Hoping it may help,
Vanderghast, Access MVP

So I just changed to my table like....

DELETE DISTINCTROW GPSData.*
FROM GPSData INNER JOIN Query2
ON GPSData.ID = Query2.ID;

Worked like a charm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top