Rx_
Nothing In Moderation
- Local time
- Today, 01:49
- Joined
- Oct 22, 2009
- Messages
- 2,803
Will this code use up too many resources? Is there a better way or suggestion to accomplish the same thing?
On main switchboard - log the time the form loads - after form is open for 3 hours, shorten the timer interval to 5 sec. Show and flash warning label asking user to exit the application.
Users are on Citrix with remote wireless and sometimes they shut the lid turning off the PC. The Citrix Access session waits for them to log back in and restores the session. Restored sessions can be hours or even 5 days later. The problem is that a new Access application Version may have been released.
This warning ask users to exit the application. When the user logs back on, a new copy of the latest Access application Version is loaded automatically.
The resource usage with 10 to 40 concurrent people on a Citrix server is my main concern. Any suggestions are very welcome.
On main switchboard - log the time the form loads - after form is open for 3 hours, shorten the timer interval to 5 sec. Show and flash warning label asking user to exit the application.
Users are on Citrix with remote wireless and sometimes they shut the lid turning off the PC. The Citrix Access session waits for them to log back in and restores the session. Restored sessions can be hours or even 5 days later. The problem is that a new Access application Version may have been released.
This warning ask users to exit the application. When the user logs back on, a new copy of the latest Access application Version is loaded automatically.
The resource usage with 10 to 40 concurrent people on a Citrix server is my main concern. Any suggestions are very welcome.
Code:
Option Explicit
' As form starts up, record the time. After form is open a specific period of time, make obnoxious lable flash and ask user to close.
Dim StartTimer As Date
Dim TimeNow As Date
Dim TotalTime As Long
'Private Const TIMER_Show_Warning = 10800 ' afer 3 hours -go to flash warning mode
Private Const TIMER_Show_Warning = 60 ' test mode 1 min
Private Sub Form_Load()
On Error Resume Next
DoCmd.Restore
StartTimer = (Now())
Me.TimerInterval = 100000 ' checkTimer_Show_Warning
Me.lblPleaseCloseForm.Visible = False ' hide warning label
End Sub
Private Sub Form_Timer()
On Error Resume Next
TimeNow = Now()
TotalTime = DateDiff("s", [StartTimer], [TimeNow])
Debug.Print "TotalTime = " & TotalTime & " of " & TIMER_Show_Warning
If TotalTime > TIMER_Show_Warning Then
Me.lblPleaseCloseForm.Visible = True ' now show label
Me.TimerInterval = 5000 ' flash ever 5 sec
If Me.lblPleaseCloseForm.ForeColor <> vbRed Then
Me.lblPleaseCloseForm.ForeColor = vbRed
Else
Me.lblPleaseCloseForm.ForeColor = vbBlack
End If
End If
End Sub
Last edited: