I'm trying to automate a search function on a company website and pull back the results into access or excel. I can get access to open an instance of Internet Explorer, navigate to the correct page, fill in the appropriate text box, but when I try to tell it to click the search button or submit the form, it fails. There's no error or response from the site. It looks like it refreshes quickly, but it doesn't display the results. When I manually click the button, it displays results.
Applications:
MS Access 2003
Internet Explorer 8.0.6001.18702
The source information from the website is attached.
Below is the section where the search button is located.
Expand|Select|Wrap|Line Numbers
- <div class='modalwindowbuttons'>
- <input type='hidden' name='action' value='search'>
- <input type='submit' name='Search' value='Search'>
- </div>
Expand|Select|Wrap|Line Numbers
- Option Compare Database
- Private Function testIE()
- Dim sURL As String
- Dim oIE As InternetExplorer
- Dim oElement As Object
- Dim oCollection As Object
- Dim sAccount As String
- Dim oAcct As Object
- Dim i As Integer
- sURL = "http://<removed>/ACHDispute/index.php?page=disputeform&action=search"
- Set oIE = CreateObject("InternetExplorer.Application")
- oIE.NAVIGATE sURL
- oIE.Visible = True
- Do While oIE.busy Or oIE.READYSTATE <> 4
- DoEvents
- Loop
- sAccount = "#######"
- Set oAcct = oIE.Document.getElementsByName("acctnum")
- oAcct.item(0).Value = sAccount
- oIE.Document.getElementById("Search").Click
- oIE.Document.getElementById("searchForm").submit
- End Function