Not Understood Warning Message

VB2010 - VB2010
ACCDB data file

I am receiving the following warning message.  I do understand what the message is saying, but I don't understand how to resolve the warning message.  The message is:

The type for variable 'icnt' will not be inferred because it is bound to a field in an enclosing scope. Either change the name of 'icnt', or use the fully qualified name (for example, 'Me.icnt' or 'MyBase.icnt').      

The code that generates the warning message follows:
If bolFoundItem = True And bolfounditem2 = True And bolfounditem3 = True Then
                        icnt = 0
                        For icnt = 1 To iCount
                            myRS5("Invoice Number").Value = myRS("Invoice Number").Value
                            myRS5("Contract number").Value = myRS("Contract Number").Value
                            myRS5("Contractor Name").Value = wrkContractorName
                            myRS5("Date Received").Value = myRS("Stamped date").Value
                            myRS5("Date to GTR").Value = myRS("Date to GTR").Value
                            myRS5("GTR Name").Value = wrkGTRName
                            myRS5("Acceptance Date").Value = myRS("Acceptance Date")
                            myRS5("Program Code").Value = arrPA(icnt - 1)
                            myRS5("Invoice Amount").Value = arrPAA(icnt - 1)
                            myRS5("DaysInProcess").Value = intDaysinProcess
                        Next icnt
                    End If

This is nothing more than a simple loop.  The purpose is to write unique records for up to 5 line items in an invoice.  
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Do you declare icnt somewhere? You can also change

  icnt = 0
                        For icnt = 1 To iCount


For icnt As Integer = 1 To iCount

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
What happened is apparently you declared icnt earlier and it's still in scope. My guess is you declared it as something else.
I wouldn't expect redeclaring it to work.
If you declared it previously right before a loop, declare it in both places inside the loops (as CodeCruiser suggested) and the scoping will be fixed so the won't shadow each other.

If it was previously declared as an integer, then why would it complain at all? Are you using Option Explicit and giving all your variables types? You should be.
WLoftusAuthor Commented:
icnt was a public declared variable to be used in other places.  The goal was to use it for additional needs, but basically codecruiser resolution resolved the issue.  
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.