Yeah, it's possible.
One way would be to declare a Global Variable in a module (can't be a class
module, nor a module associated with a form):
Public gbooShutdown As Boolean
In the Load event of the DetectIdleTime form you just created, set
gbooShutdown to False.
Create a new form (call it PromptUser) that has a label telling the user
that the application will be shut down in 30 seconds unless they click on
the NO button. Add two buttons onto the form: one labelled OK and one
labelled NO.
In the PromptUser form's Load event, set Me.TimerInterval = 30000
In the Click event of the NO button, you want:
Private Sub txtOK_Click()
gbooShutdown = True
DoCmd.Close acForm, Me.Name
End Sub
In the Click event of the OK button, you want:
Private Sub txtOK_Click()
gbooShutdown = False
DoCmd.Close acForm, Me.Name
End Sub
In the Timer event of the form, you want
Private Sub Form_Timer()
gbooShutdown = True
DoCmd.Close acForm, Me.Name
End Sub
What this does is if the user clicks on OK, it sets the global variable to
True and closes the form. If the user clicks on NO, it sets the global
variable to False and closes the form. If the user does nothing in 30
seconds, it set the global variable to True and closes the form.
Go back to the DetectIdleTime form, and change sub IdelTimeDetected to
something like:
Sub IdleTimeDetected(ExpiredMinutes)
If gbooShutdown = False Then
DoCmd.OpenForm "PromptUser", WindowMode:= acDialog
End If
If gbooShutdown = True Then
Application.Quit acSaveYes
End If
End Sub
What this does is if the global variable is False, it opens the PromptUser
form in Dialog mode (meaning that code processing stops until the PromptUser
form is closed). Once processing resumes, it checks the value of the global
variable. If the user closed the PromptUser form by clicking on OK or if the
user didn't do anything so that the form closed on its own after 30 seconds,
the global variable will now be True, so it shuts down the application. If
the user closed the PromptUser form by clicking on NO, the global variable
will still be False, so it doesn't shut down the application.