Quantcast
Channel: Internet Explorer Web Development forum
Viewing all articles
Browse latest Browse all 3527

elm.innertext fails randomly (?)

$
0
0

v = elm.innertext works most of the time, but sometimes I get :

Run time error 438,  Object does not support this property or method

 

Here's the code. I'm new to programming IE so please dont be shy telling me I dont know what I'm doing and should have done it the other way. I does work 80% of the time though(of course my client wants %100 !)

 
Dim ie As Object
Set ie = CreateObject("internetexplorer.application")
URL = "https://rather not give out site URL.htm"
ie.Visible = True

DoCmd.SetWarnings False
DoCmd.RunSQL "delete * from results"
DoCmd.RunSQL "delete * from results_d"
DoCmd.SetWarnings True
a = 0
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("T")
Set rs2 = db.OpenRecordset("results")
Set rsd = db.OpenRecordset("results_D")
Do While Not rs.EOF
T = rs!TICKET
ie.Navigate URL
 
 
 While ie.Busy
            DoEvents
          Wend
         
      
 
ie.Document.getElementById("ItemSearchQuestionUserInput_0__QuestionAnswer").Value = T
ie.Document.getElementById("ItemSearchQuestionUserInput_1__QuestionAnswer").Value = "NY"


While ie.Busy
            DoEvents
          Wend
          
          
          
'Set ie = Nothing
'ItemSearchQuestionUserInput[1].QuestionAnswer
ie.Document.all("SubmitButton").Click
While ie.Busy
            DoEvents
          Wend
          
    a = 0
For Each elm In ie.Document.getElementsByClassName("lineItemTextCell lineItemColumn2Cell")

    While ie.Busy
            DoEvents
          Wend
        v = elm.innertext
        
         rs2.AddNew
        rs2!summons = v
        rs2!plate = T
         rs2!num = a
        rs2.Update
        
        Debug.Print T & "  " & v & "  " & a
             a = a + 1
         
          While ie.Busy
            DoEvents
          Wend
      
Next elm


   a = 0
For Each elm In ie.Document.getElementsByClassName("lineItemTextCell lineItemColumn4Cell")

    While ie.Busy
            DoEvents
          Wend
        v = elm.innertext
        
         rsd.AddNew
        rsd!theDate = v
        rsd!plate = T
         rsd!num = a
        rsd.Update
        
        Debug.Print T & "  " & v & "  " & a
             a = a + 1
         
          While ie.Busy
            DoEvents
          Wend
      
Next elm




rs.MoveNext
 Loop ' 
 
 
 
 rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
ie.Quit
 Set ie = Nothing
 

===============

This line also gets random failures 

ie.Document.getElementById("ItemSearchQuestionUserInput_0__QuestionAnswer").Value = T 


Viewing all articles
Browse latest Browse all 3527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>