IN SHORT:
Is there a way to create delete query that deletes records from a table based a query that's also based on the same table?
BACKGROUND: I have a daily report that has a 7 day history... I would like to set up a db to keep track of all of the historical data in it. In addition i would like foir this db to run the daily summary on latest day within available data.
i've set up the db, where once a day i'll simply drop a report into a folder, then open access db and run "import" macro. the macro simply imports the data into my main table.
my main problem is that i am basically adding data for each record 7 times (as the same data from one day will show up in 7 daily reports (daily report with 7 day history)... i'd l ike to set up some sort of delete query to clean my main table of duplicate rows.
the data has "import date" field (default value Date()... so it basically keeps track of when i've uploaded the data. I'd like to use that import date as a flag to decide if a record shouold be deleted. I have a subQ that pulls data elements for the record (excluding record ID and import date) to list a number of unioque records in the database. then i add "Max Import Date" field to show the last time this record was imported.
What i'd like to do is use that query to go throgh the table and delete all of the records that <> Max Import Date. It would seem like a simple delete query (i am new to them... so perhaps i am wrong)... i can run the select query and it showes all the right records to be deleted. However when i change the query to "delete query" it does not remove the records and gives me this message:
"COULD NOT DELETE FROM SELECTED TABLE"
I am guessing it is because the query i use to identify the records to be deleted is based on the table where deletions are about to take place... is there a way around it? Or is this something else?
I've tried to make the query a "Make Table" query to use the table as a list of records to be deleted, but it's not very solid logic and it still doesn't work.
any advice would be of much help.