I have a couple of queries set up to get a very select list of records. So far, all of those are working properly. Now that I have what data I need, I would like to write a query to Delete those results with matching IDs from the original table. Table "Records" - holds data regarding absences Query "Sums" - calculates difference between dates, sums absences Query "PrevAnn" - all records from "Sums" who's difference is greater than 1 year, except the most recent date. Those are the records I would like to delete from table "records" This is what I have for the "Delete" query: DELETE Records.* FROM Records INNER JOIN PrevAnn ON Records.ID=PrevAnn.ID Am I on the right track here?
Annie, Are you still trying to delete from the linked Excel spreadsheet, or did you import into an Access table. If you imported into an Access table, then you should be able to do: DELETE Records.* FROM Records WHERE Records.ID IN (SELECT DISTINCT ID FROM PrevAnn) -- HTH Dale Don''t forget to rate the post if it was helpful! email address is invalid Please reply to newsgroup only. "Allie" wrote: > I have a couple of queries set up to get a very select list of records. So > far, all of those are working properly. Now that I have what data I need, I > would like to write a query to Delete those results with matching IDs from > the original table. > Table "Records" - holds data regarding absences > Query "Sums" - calculates difference between dates, sums absences > Query "PrevAnn" - all records from "Sums" who's difference is greater than 1 > year, except the most recent date. > > Those are the records I would like to delete from table "records" > > This is what I have for the "Delete" query: > > DELETE Records.* > FROM Records INNER JOIN PrevAnn ON Records.ID=PrevAnn.ID > > Am I on the right track here? > >
It is a separate table. And WOO HOO it worked. Thanks Dale. "Dale Fye" wrote: > Annie, > > Are you still trying to delete from the linked Excel spreadsheet, or did you > import into an Access table. > > If you imported into an Access table, then you should be able to do: > > DELETE Records.* > FROM Records > WHERE Records.ID IN (SELECT DISTINCT ID FROM PrevAnn) > > -- > HTH > Dale > > Don''t forget to rate the post if it was helpful! > > email address is invalid > Please reply to newsgroup only. > > > > "Allie" wrote: > > > I have a couple of queries set up to get a very select list of records. So > > far, all of those are working properly. Now that I have what data I need, I > > would like to write a query to Delete those results with matching IDs from > > the original table. > > Table "Records" - holds data regarding absences > > Query "Sums" - calculates difference between dates, sums absences > > Query "PrevAnn" - all records from "Sums" who's difference is greater than 1 > > year, except the most recent date. > > > > Those are the records I would like to delete from table "records" > > > > This is what I have for the "Delete" query: > > > > DELETE Records.* > > FROM Records INNER JOIN PrevAnn ON Records.ID=PrevAnn.ID > > > > Am I on the right track here? > > > >