Forum Discussion

MarinaKaz's avatar
MarinaKaz
Occasional Contributor
13 years ago

Exception: the object was not found by Microsoft Jet

Hello, I have a problem: my DDT.CSVDriver is created successfully 8 times and I get the error at 9-th time. It doesn't depend on the field or datFile itself, it definitely depends on the function calls count. I checked that the SCVDriver is closed every time.

What can be the reason of the problem?



Function CheckField(field, datFile)

  Dim pathData

  Dim enter, check

 

  pathData = "..\dat\check\"



  Call Log.Message("field "&field.Name)



  Set DataDriver = DDT.CSVDriver(pathData&datFile)  



  While Not DataDriver.EOF

    Call aqObject.SetPropertyValue(field, "Text", "")

     

    enter = VarToStr(DataDriver.Value(0))

    check = VarToStr(DataDriver.Value(1))

   

    Call field.Keys(enter)

    If field.Text = check Then

      Call Log.Message(VarToStr(enter) & " is entered as "&field.Text)

    Else

      Call Log.Error(VarToStr(enter) & " is entered as "&field.Text&", was expected "&check)

    End If

    

    Call DataDriver.Next()

  WEnd      



  Call Log.Message(DataDriver.Name)



  If Not DDT.DriverByName(DataDriver.Name) is Nothing Then

    DDT.CloseDriver DataDriver.Name

  End If



End Function

4 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Marina,



    Just a quick idea: what if you add

    Set DataDriver = Nothing



    just before the function end?

    Does it help?
  • MarinaKaz's avatar
    MarinaKaz
    Occasional Contributor
    Hi Alexey!

    Sorry, it didn't help. Please find attached error message, it's the same.

    Any other ideas?
  • Hi Marina,



    The routine works fine for me no matter how many time I call it.


    The pathData variable in your script is a relative path. It is relative to the "current directory" of the TestComplete application.


    I guess it may be the reason of the problem - the current directory changes for some reason, and the path becomes invalid.



    Try posting the path to the Test Log to see if this is the case:





    Log.Message("The file path is: " & pathData & datFile)

    Set DataDriver = DDT.CSVDriver(pathData & datFile)





    Is the path correct in the cases when you are getting the Jet engine error?
  • MarinaKaz's avatar
    MarinaKaz
    Occasional Contributor
    Hi, Alexey!



    Thanks a lot! :-)

    It was my fault with paths! Thank you for your idea!



    Marina