I am comparing picture names in a Folder with the names in a table, in order to find files that are not referenced within the database. I call these "Orphans"
This routine is imbedded in a large program, and I am only presenting a small fraction of the code. All variables are declared. Those beginning with str... are String, beginning with ii... are Long, lbl... are Labels, etc.
The routine worked, but the image flickered because line 22 of the code is executed ~80K times. To reduce the flicker, I inserted the lines marked as "Added line". The code still works, but the label on the form (lblDisplay) isn't displayed until cmdFindOrphans_ Click exits. As a matter of fact, the timer event appears not to be triggered, as the function (code lines 28-30) is never executed.
A toggle breakpoint at line 25 has TimerInterval = 250, as it should. Before you ask, yes, the property sheet for the form has [Event Procedure], and the [. . .] gets me to the code corresponding to line 28.
Is there something I am missing here?
OldBirdman
This routine is imbedded in a large program, and I am only presenting a small fraction of the code. All variables are declared. Those beginning with str... are String, beginning with ii... are Long, lbl... are Labels, etc.
The routine worked, but the image flickered because line 22 of the code is executed ~80K times. To reduce the flicker, I inserted the lines marked as "Added line". The code still works, but the label on the form (lblDisplay) isn't displayed until cmdFindOrphans_ Click exits. As a matter of fact, the timer event appears not to be triggered, as the function (code lines 28-30) is never executed.
A toggle breakpoint at line 25 has TimerInterval = 250, as it should. Before you ask, yes, the property sheet for the form has [Event Procedure], and the [. . .] gets me to the code corresponding to line 28.
Is there something I am missing here?
Code:
Private Sub Form_Load()
. . . .
Me.TimerInterval = 0 'Added line
End Sub
cmdFindOrphans_Click
iiRecCt = 0
iiOrphanCt = 0
lblDisplay.Caption = ""
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("SELECT . . .")
strFile = Dir(strPath & "\*.*")
Me.TimerInterval = 250 'Added line
Do Until strFile = ""
iiRecCt = iiRecCt + 1
If IsOrphan(arg1, . . .) = True Then
iiOrphanCt = iiOrphanCt + 1
. . . .
End If
lblDisplay.Caption = "Checked=" & iiRecCt & " Orphans=" & iiOrphanCt
'Me.Repaint 'Original line
strFile = Dir()
Loop
Me.TimerInterval = 0 'Added line
End Sub
Private Sub Form_Timer() 'Added line
Me.Repaint 'Added line
End Sub 'Added line
Comment