Search code examples
ms-accessexcelfieldrecordsetvba

Object does not accept method


I'm experiencing a problem with my VBA application.
I need to define a Recordset and enter the result of a certain field, line by line, into an Excel Worksheet. The problem is, when I do this

With appXLS.Worksheets("Resultado Geral")
    For intPosition = LBound(Arr) To (UBound(Arr) - 1)
        teste = Arr(intPosition, 0) & "_Status"
        .Cells(i, 6) = MyRecBase.Fields(teste)
    Next
End With

It displays the problem (Error '438') and marks the ".Cells" line. But the biggest problem is that I use the same method a few lines before.

Please, help me. I would appreciate.

Thanks in advance


Solution

  • Check the line in your code:

    .Cells(i, 6) = MyRecBase.Fields(teste)
    

    since it is not evident what i is and how it is calculated based on your loop.