MS Access application forms flickers while I have timer to quit application (1 Viewer)

Ihk

Member
Local time
Today, 23:51
Joined
Apr 7, 2020
Messages
280
I have timer on two forms.
1) login form (after user logs in -- this is hidden but not closed)
2) Dashboard (on top right corner it shows, count down time, but on activity time restarts)
code on timer is below
Timer interval is 1000
Both forms have same code, except login form wont show count down. What do you think, if I run the will it always flicker unless no timer?

Code:
Private Sub Form_Timer()

Const IDLEMINUTES = 20
Static PrevControlName As String
Static PrevFormName As String
Static ExpiredTime
Dim ActiveFormName As String
Dim ActiveControlName As String
Dim ExpiredMinutes
On Error Resume Next
' Get the active form and control name.
ActiveFormName = Screen.ActiveForm.Name
If Err Then
ActiveFormName = "No Active Form"
Err = 0
End If
ActiveControlName = Screen.ActiveControl.Name
If Err Then
ActiveControlName = "No Active Control"
Err = 0
End If

If (PrevControlName = "") Or (PrevFormName = "") _
Or (ActiveFormName <> PrevFormName) _
Or (ActiveControlName <> PrevControlName) Then
PrevControlName = ActiveControlName
PrevFormName = ActiveFormName
ExpiredTime = 0
Else

ExpiredTime = ExpiredTime + Me.TimerInterval
End If
' Does the total expired time exceed the IDLEMINUTES?
ExpiredMinutes = (ExpiredTime / 1000) / 60
Me.txtIdleTime = ExpiredMinutes

'here above Me.txtIdleTime is my control on form, which shows count down time.

If ExpiredMinutes >= IDLEMINUTES Then

ExpiredTime = 0

IdleTimeDetected ExpiredMinutes
End If
End Sub
 

Ranman256

Well-known member
Local time
Today, 17:51
Joined
Apr 9, 2015
Messages
4,337
the timer will do that. My users complained because the cursor would leave the entry box while typing.
I had to remove the timer of the form to stop it BUT I added an invisible form (fHidden) with a timer that users don't see nor use.

Use a global variable that gets checked. The form the users enter will keep resetting the counter during the KEYDOWN event.
We don't get the flicker. At least on our version.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:51
Joined
May 7, 2009
Messages
19,246
which form is flickering, the dashboard?
make sure No controls are overlapping each other
and remove the Layout from the controls.
 

Ihk

Member
Local time
Today, 23:51
Joined
Apr 7, 2020
Messages
280
which form is flickering, the dashboard?
make sure No controls are overlapping each other
and remove the Layout from the controls.
Okay, Now I am getting closer if this is the reason.
Dashboard has horizontal navigation pannel, mostly one form under (one of these navigations flickers most often.
As you pointed out no controls should overlap, this can be reason.
This is my continous form and it has "unbound control" under all bound controls (Horizontally). It is to highlight the row (selected).
this long horizontal control "txtHighlight"
I am using
Conditional format (Expression : [ID]=[txtCurrent] ), Yellow backcolour
Form current also
Code:
Me.txtCurrent = Me.[ID]

Do you think this could be the reason?
And I dont use layout, adjust control manually and under arrange option.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:51
Joined
May 7, 2009
Messages
19,246
if the Continuous form is but a simple Datasheet, why not use a Real Datasheet subform.
continuous forms are notorious for flickering.
 

Ihk

Member
Local time
Today, 23:51
Joined
Apr 7, 2020
Messages
280
if the Continuous form is but a simple Datasheet, why not use a Real Datasheet subform.
continuous forms are notorious for flickering.
This is good to know, a new learning curve.
I used continuous form because of more control. Like header sorting and column width etc, also (datasheet) then to user it looks like an excel sheet, with which they are used to.
Thank you very much I will try this way.
But I must say this, in-spite timer is there flickering is gone in my test version.
 

Users who are viewing this thread

Top Bottom