Runtime 438 Error

abbaddon223

Registered User.
Local time
Today, 15:46
Joined
Mar 13, 2010
Messages
162
Hi,

I'm trying to get some information in and out of a web page (very new to this). The code is below. The aim of this is to take information from a form, input it into the site, run a search, then take the returned info and pop it back into some empty fields on the form.

The highlighted red area is where I keep getting a debug: Run Time Error 438: Object Does Not Support This Property or Method.

I'm pretty sure that the field in the web page which I'm referencing is correct. Is there anything else this could be? Thank you in advance for any support.

Private Sub Command0_Click()
'sets focus - possible debug area

[Phone_Number].SetFocus
'Declares Variable

Dim ie As Object
Set ie = CreateObject("internetexplorer.application")
ie.Visible = True

'Nav to page
ie.navigate "URN Name Removed"
'Pauses whislt page loads

While ie.busy
DoEvents
Wend

'Inputs phone number into Phone Number: field
ie.Document.getElementById("ctl00_ctl00_ContentPlaceholderColumnThree_ctl00_txtTelephone").Value = [Forms]![Frm_Web_Open]![Phone_Number]

'Clicks the go button
ie.Document.all("ctl00_ctl00_ContentPlaceholderColumnThree_ctl00_btnCheckADSL").Click

'waits for search to complete
While ie.busy
DoEvents
Wend

'Get's standard speed
[Current_ADSL_Up].Text = ie.Document.getElementById("ctl00_ctl00_ContentPlaceholderColumnTwo_ctl02_lblSpeedEstimate").Value
End Sub
 
What is [Current_ADSL_Up]? A text field on your form? If so, drop the .text property; I think that is what is causing your problem. All you need is the text field reference, that's the property that would be invalid. oh, and if the procedure is in a module and not in an event on the form, make sure you have the form reference (from your code that would probably be Forms![Frm_Web_Open].)
 
Hi cyb3rwolf,

Thank you very much for replying to this thread. I took the .text off the field (yes it's a field in the form) but still got the same error.

I also then took the .value off the end of the code that was giving me the issue and did get a result back into the ms access form field (not the one I want, but an improvement).

The result I got was [object HTMLSpanElement]

And the element ID I am referencing is

<span id="ctl00_ctl00_ContentPlaceholderColumnTwo_ctl02_lblSpeedEstimate">7.5Mbps</span>

So it looks like taking the .value off was the issue, but now it is not referencing the bit I need (7.5Mbps). Thanks again!!
 
I think if you use .innerText instead of .value you should be good to go. Try that and see if it works. .value is an attribute; meaning that the html tag would have to have value="(something here)" to retrieve it using that property.
 
So, what i think you need is this:

[Current_ADSL_Up] = ie.Document.getElementById("ctl00_ctl00_ContentPla ceholderColumnTwo_ctl02_lblSpeedEstimate").InnerText
 
Maaaaate - you are a total legend!! Worked perfectly. Thank you so much for helping me with this!!!!
 

Users who are viewing this thread

Back
Top Bottom