Auto Delete Records?

Rugby83

New member
Local time
Today, 11:02
Joined
Jun 14, 2005
Messages
7
I am creating a web database where users submit entries using an online form. When they submit the entry, I am saving the entry date and time in a column called Timestamp. What I need to figure out is if there is a way to create some sort of expiration date, based on the Timestamp, that will automatically delete a record after it is 7 days old. Is there a way to do this? Thanks so much for any help that you can give.
 
1. Create a delete query that deletes records where [timestamp]<now()-7
2. If you want this to happen automatically, just run this query in response to some event that happens regularly... like opening the main form in the database.
 
Sounds great. How do I create a delete query? I already have a query that returns the entries that are more than 7 days old. Also, how do I make the query run automatically every time the database is accessed? Unfortunately I don't know a lot about the coding side of Access at all.

Thanks so much for the help!
 
Last edited:
To create a delete query: When designing your query, just select "delete query" from the query menu. For more info, see access help.

To make the query run in response to an event: If you are totally unfamiliar with using events, you will need to read up on using events, decide what event is appropriate, and then just add the following code snippet to that event:

currentdb.execute "myqueryname",dbfailonerror

Your database probably has a main form. I would recommend using the "OnOpen" event of the main form.
 
Thanks so much. It works great, plus I learned a lot.
 
You are very welcome...Thanks for letting me know!
 

Users who are viewing this thread

Back
Top Bottom