code execute while inactive

I

iccsi

I have code to execute on form_timer to notify user to close
application for maintenance.

I just relaized that the code on form_timer does not execute when the
application is inactive.

I wanted the code to run if user does not response for more than 5
minutes. If the code does not execute while inactive then I can not
force to close the application if user does not active the
application.


Your information is great appreciated,
 
Y

Yanick

Try this. There is surely a menu of some sort in your database (a form that
will be always open). Have this form looking for a value in a table once in a
while. If the value is there, open a pop-up which will be in front of every
other open form. Set the OnClose event of that windows to close your DB to be
sure nobody try to keep it open. Then set the timer of that form to close the
DB after a certain laps of time.

Here my code for the pop-up form. Work fine for me.

---------
Option Compare Database
Option Explicit

Dim CloseTime As Date

Private Sub Form_Close()
If DLookup("[ActiveFlag]", "TBL-UpdateFlagTable", "[ID] = 1") = True Then
DoCmd.RunMacro "QuitMacro"
End If
End Sub

Private Sub Form_Load()
CloseTime = Now()
Me.MsgText.Value = Now() & "Insert msg here or Dlookup in a table for
more standard msg"
Me.Repaint
End Sub

Private Sub Form_Timer()
If DateDiff("n", CloseTime, Now()) >=
DLookup("[TimeBeforeShutdown]", "TBL-UpdateFlagTable", "[ID] = 1") Then
DoCmd.RunMacro "QuitMacro"
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top