Close RECORD after a pre-defined time

  • Thread starter Thread starter RitchieJHicks
  • Start date Start date
R

RitchieJHicks

Hi,

I realise that I can set a form or report to close after a predefined time
using the forms timer function, but how can I set a time to close a form or
record after a time of say 20 minutes.

I want to avoid a user sitting in a record (and therefore keeping it
locked). Turning off record locking isn't an option.

Also, how come there's so much spam on these forums now?

Thanks,
Ritchie.
 
Believe me, we report the spam to Microsoft every day. I have no idea what
takes them so long to clean it up. Annoying, isn't it?

As to your question. You can use a timer event in a form do do whatever you
want.
The basic concept is to Dim a Moule level date time variable and populate it
with Now depending on when you want the time to start. If it is at the
record level, use the Form Current Event. That way the the countdown will
restart each time the user moves to a different record.

Dim dtmStartTime As Date


Private Sub Form_Current()

dtmStartTime = Now

Private Sub Form_Timer()

If DateDiff("n",dtmStartTime, Now) >= 20 Then
Docmd.Close acForm, Me.Name, acSaveNo
End If


So you could set your timer interval to one minute (60000) and the code to
check to see how long since the record changed would fire one each minute.
The example above closes the form. You might want to add a warning message
if you are a nice person <g>
 
Back
Top