Avoid Flicker (1 Viewer)

JohnPapa

Registered User.
Local time
Today, 10:21
Joined
Aug 15, 2010
Messages
954
I am trying to avoid flicker on the form when I run the following code where all checkboxes are set to No.
I used Appilication.Echo set to False at the beginning and set to True end. Did not help
I used Me.Visible set to False at the beginning and set to True end. There is no flicker, during the update but a major flicker at the end.


Code:
Dim rst As Recordset
Set rst = Me.RecordsetClone
rst.MoveFirst
Do While Not rst.EOF
    If Nz(rst!blnNo, False) = False And Nz(rst!blnYes, False) = False Then
        rst.Edit
        rst!blnNo = True
        rst!blnYes = False
        rst.Update
    End If
    rst.MoveNext
Loop
Me.Dirty = False
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:21
Joined
Oct 29, 2018
Messages
21,358
Have you considered using an UPDATE query to change the source table and just requery the form?
 

JohnPapa

Registered User.
Local time
Today, 10:21
Joined
Aug 15, 2010
Messages
954
Actually, I just tried that and was going to report on it. Thanks for the suggestion anyway.
There is still a flicker.

Code:
Application.Echo False
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE tblMedicalHistoryPatTempNew SET blnNo = True, blnYes = False WHERE lngMedicalHistory = " &      Forms!frmMedicalHistoryListNew!lngID & ";"
DoCmd.SetWarnings True
Me.Refresh     'Or Me.Requery
Me.cmdCancel.SetFocus
Application.Echo True
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:21
Joined
May 7, 2009
Messages
19,169
have you tried using Datasheet form?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 08:21
Joined
Feb 19, 2013
Messages
16,553
does your form use conditional formatting? - that can sometimes impact form flicker
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:21
Joined
Feb 19, 2002
Messages
42,981
This seems to be a design flaw. Why are you resetting values on a bunch of child records at once?
 

JohnPapa

Registered User.
Local time
Today, 10:21
Joined
Aug 15, 2010
Messages
954
does your form use conditional formatting? - that can sometimes impact form flicker
Yes it does. The yellow which indicates the current record uses conditional formatting.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:21
Joined
May 7, 2009
Messages
19,169
you create a New Datasheet form from your table.
you don't use an "existing" continuous form and Switch to datasheet view.
continuous forms are notorious for flicker, because it need to "repaint" the controls everytime.
 

JohnPapa

Registered User.
Local time
Today, 10:21
Joined
Aug 15, 2010
Messages
954
you create a New Datasheet form from your table.
you don't use an "existing" continuous form and Switch to datasheet view.
continuous forms are notorious for flicker, because it need to "repaint" the controls everytime.
Thanks for the suggestion. It may not be worth the effort to remove the flicker.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:21
Joined
May 7, 2009
Messages
19,169
you can also add Conditional format to datasheet.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 08:21
Joined
Feb 19, 2013
Messages
16,553
Yes it does. The yellow which indicates the current record uses conditional formatting.
try temporarily disabling the conditional formatting - does this stop the flickering?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:21
Joined
May 7, 2009
Messages
19,169
you don't really need conditional format (for current record) in datasheet since, there is already a band to do this.
but to demonstrate i put the dsSub (datasheet) in a Form (2_Form1) to show that it can be done.
notice the flicker on 1_Continuous form, while almost none to 2_Form1.
 

Attachments

  • ContinuousVsDS.accdb
    544 KB · Views: 109

Users who are viewing this thread

Top Bottom