Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set time limit For a record?

Status
Not open for further replies.

DirtDawg

IS-IT--Management
Apr 17, 2002
218
0
0
JP
Hello all,

I woudl like to be able to set a time limit for a record to be accessed. After the timie limit has been reached the record is deleted. Anyone have ideas?

Thanks in advance
 
Hi

In your table definition declare a column of type date/time, (datCreated), with a default value of Date() Or Now(), use Date() if you just want to delete based on days old, if yo want to go down to hours or minutes use Now()

As part of your start up of your database run a query to delete all records older thatn specified time eg

DELETE * FROM MyTable WHERE datCreated <= DateAdd(&quot;d&quot;,-1,Date())

to delete all records 1 day old or older

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
This should help.


Sub Form_Load()
Me.TimerInterval = 1000 '1sec
End Sub

Sub Form_Timer()
DoCmd.RunSQL &quot;DELETE FROM table_name WHERE column_name = some_value;&quot;
End Sub


~amcodah()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top