I have a Time Card form where I want to keep records around for 5 weeks or so, but whenever a new weekly time card is submitted, I want to delete any records that are more than 5 weeks older than the one just submitted (so that an employee can review previous expenses, job hours, etc., for the past month or so, even though they don't have the ability to resubmit an old time card.)
So, every time they click the "Submit Current Time Card" button, I run a Query that Appends the weeks changes to a master table. I then want to run this query to delete records in the local table that are more than 35 days old. The table and timestamp for each local record is [JobHours]![WeekEnding]. The time stamp for the last time card submitted is [TimeCard]![WeekEnding]. So my delete query in Design View looks like this:
When I run this as a Select Query, I get the list of old records that I want to delete. But when I change the Query to a Delete Query and run it, I get the error "Could not delete from specified tables." Am I running into a protections thing? When I view the table I want to modify in a form, I can delete records no problem. Also, when I run my Delete Query from a form, I get the same error.
Thanks in advance.
Rich
So, every time they click the "Submit Current Time Card" button, I run a Query that Appends the weeks changes to a master table. I then want to run this query to delete records in the local table that are more than 35 days old. The table and timestamp for each local record is [JobHours]![WeekEnding]. The time stamp for the last time card submitted is [TimeCard]![WeekEnding]. So my delete query in Design View looks like this:
Code:
Field: JobHours.* WeekEnding
Table: JobHours JobHours
Delete: From Where
Criteria: <[TimeCard]![WeekEnding]-35
Thanks in advance.
Rich