Events inside loop affected

  • Thread starter Thread starter Andy G
  • Start date Start date
A

Andy G

I have a big loop in the OnOpen event of a form. Inside this loop I want to
change the color of these boxes as the records are processed. It seems like
when the myControl.BackColor = vbBlue is ran inside the loop it doesn't have
an event to make it change. The color of the boxes change after a msgbox is
thrown after the line of code to change the box color.

Any ideas?
 
I have a big loop in the OnOpen event of a form. Inside this loop I want to
change the color of these boxes as the records are processed. It seems like
when the myControl.BackColor = vbBlue is ran inside the loop it doesn't have
an event to make it change. The color of the boxes change after a msgbox is
thrown after the line of code to change the box color.

Any ideas?


You're probably using the wrong event, but without seeing the code,
and without more information, I won't try to give any suggestions.
 
Below is a snippet of the code I am using. The even that fires all of this
code is a button click.

Do While Not rsHolding.EOF
'A bunch of code here using recordsets to update and insert records.

recCounter = recCounter + 1
If recCounter = incCounter Then
strControl = box & boxCounter
Me.Controls(strControl).BackColor = vbBlue
incCounter = incCounter + 3
boxCounter = boxCounter + 1
End If
Loop

msgbox "Import complete"

The boxes that are sopose to turn blue as the loop process don't update
until the above msgbox comes up. The code in that if statement just checks
if the number of records processed equals 3, and then fills in one of the
boxes on the screen for an progress bar effect.

Hopefully this helps a little more.
 
See added code below

Andy G said:
Below is a snippet of the code I am using. The even that fires all of this
code is a button click.

Do While Not rsHolding.EOF
'A bunch of code here using recordsets to update and insert records.

recCounter = recCounter + 1
If recCounter = incCounter Then
strControl = box & boxCounter
Me.Controls(strControl).BackColor = vbBlue Me.Repaint
incCounter = incCounter + 3
boxCounter = boxCounter + 1
End If
Loop

msgbox "Import complete"

The boxes that are sopose to turn blue as the loop process don't update
until the above msgbox comes up. The code in that if statement just checks
if the number of records processed equals 3, and then fills in one of the
boxes on the screen for an progress bar effect.

Hopefully this helps a little more.
 
Back
Top