Delete a table at certain time

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to understand if this is possible...

I currently have a table called tblSession. This inputs the User,JobNumber
user is currently viewing & DateTime. from this, everytime a User goes into a
Job then it populates the table with the JobNumber and when the User goes
into another Job it deletes the previous Job Number and replaces it with the
next Job Num. What I am wanting to do is that no one would really be in the
Database between 8PM & 7AM, I want to try and see if the first person in the
database it runs a query and deletes any sessions that are still showing in
the table, How is this possible?
 
hi Jez,
What I am wanting to do is that no one would really be in the
Database between 8PM & 7AM, I want to try and see if the first person in the
database it runs a query and deletes any sessions that are still showing in
the table, How is this possible?
You need a hidden form with a form timer.


mfG
--> stefan <--
 
Thanks for answering me.

How would I do this, I dont quite understand what you mean with having a
form and a timer, what would be on this form?
 
hi Jez,
How would I do this, I dont quite understand what you mean with having a
form and a timer, what would be on this form?
Take a look at the event page of the property editor.

The form has a OnTimer event, which is fired according to the value in
TimerInterval.

In this event you can run code like

Dim db As DAO.Database
Set db = CurrentDb
db.Execute "DELETE FROM
WHERE.."


mfG
--> stefan <--
 
I would think that you could check the table and see if there were any
records for the current date or later. If not, delete all the records in
the table.
Something like the following

If DCount("*","SomeTable","DateTime>= Date()") = 0 THEN
Currentdb().Execute ("DELETE * FROM SomeTable")
End IF

That code could be executed whenever someone launches the database, so you
would not have to do something complex to determine if they were the FIRST
one on that date to open the database.


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
Back
Top