Hello, I'm trying to automatically populate a text box on a website and then search. I'm using the following code, which looks promising. For whatever, however, despite the text box being populated, the search runs as if there is no text in the text box. If I manually copy the text from the text box and repopulate it with paste, then the search works correctly. Any idea on how I can correct this?

Sub OpenIE1()

Application.ScreenUpdating = False

Dim data As Worksheet

Set data = Worksheets("Data")
Set ie = CreateObject("InternetExplorer.Application")
     
'grab the user information
user_name = data.Cells(1, 1)
pass_word = data.Cells(1, 2)
    
'navigate to the webpage
ie.Visible = True
ie.Navigate "http://websitehere.com"
    
'login
ie.document.all.Item("username").Value = user_name
ie.document.all.Item("password").Value = pass_word
ie.document.forms(0).submit
        
'account searches
For rowvalue = 2 To data.Range("D100000").End(xlUp).Row

    account_number = data.Cells(rowvalue, 4)

    ie.document.all.Item("AccountNumber").Value = account_number
    ie.document.getElementById("btnSearch").Click
    
Next rowvalue
     
Application.ScreenUpdating = True

End Sub