UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> How To Fill Web Form Using Web Browser Control    
 
   
sugata
post Jan 27 2016, 06:41 AM
Post#1



Posts: 21
Joined: 29-August 08



Dear All,

Refer to "Access and the web HTML Object Library" posted here , I have tried to fill the form in my website with this code:
CODE
Private Sub Form_Load()
          Dim strURL As String
          Dim HTML As Object
          
10        strURL = "http://sip.hutamakarya.com/new/index.php?pilih_proyek=t"
20        Set HTML = Me.WebBrowser0.Object
30        HTML.Navigate strURL
        
End Sub

Private Sub Command1_Click()
      Dim HTML As HTMLDocument
      Dim txt As HTMLInputTextElement
      Dim btn As HTMLButtonElement

  
    'I try this code to fill text "volume" with number 12345
    
10    Set HTML = Me.WebBrowser0.Document
20    HTML.getElementsByName("volume").innerText = "12345"
          
50    DoEvents
          
End Sub


When I run the MsAccess form until the page loaded then I click the Command1 button, but resulting to this error :"Object doesn't support this property or methode"
I checked the references already attached (I use Access 2002 under Windows 8.1 ):

Microsoft Internet Control
Microsoft HTML Object Library

Please help how to resolve the error.

Thank you so much,


Regards,
Sugata
Go to the top of the page
 
BananaRepublic
post Jan 27 2016, 08:31 AM
Post#2


Dungeon Cleaner
Posts: 1,504
Joined: 16-June 07
From: Banana Republic


Addressing this particular error - I think it's because you need to reference the object, not the control.

Change the line from:

"Set HTML = Me.WebBrowser0.Document"

to:

"Set HTML = Me.WebBrowser0.Object.Document"


That said, what are you trying to do here? Seems to me you're trying to autofill some form but is it actually necessary? Without knowing more, it might be the case that you have an API available to you by the vendor of that website which would be much more friendly toward automation.
Go to the top of the page
 
sugata
post Jan 29 2016, 11:27 AM
Post#3



Posts: 21
Joined: 29-August 08



Hello BananaRepublic, thank you for your suggestion,
I have tried as follows :
CODE
Private Sub Command1_Click()
      Dim HTML As HTMLDocument
      'Dim tHTML As New HTMLDocument
      Dim txt As HTMLInputTextElement
      Dim btn As HTMLButtonElement

  
    'I try this code to fill text "volume" with number 12345
    
10    Set HTML = Me.WebBrowser0.Object.Document
20    HTML.getElementsByName("volume").innerText = "12345"

50    DoEvents

End Sub

It still rais the same error : run-time error '438' Object doesn't support this property or method.
This application is an old application in my company ,where I have to input data to web form, while I have the data in Ms.Access database
Go to the top of the page
 
RichardADD
post Feb 4 2016, 02:38 PM
Post#4



Posts: 28
Joined: 4-February 16



Hi Sagata

Have you found the answer yet ?

I am trying to do the same thing

I can get my text onto the form but have other problems after that
Go to the top of the page
 
BananaRepublic
post Feb 4 2016, 02:46 PM
Post#5


Dungeon Cleaner
Posts: 1,504
Joined: 16-June 07
From: Banana Republic


Does it raise error even if you put a breakpoint before you set the document? It might be the case that the document isn't loaded and thus you are reading the property too prematurely?
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    11th December 2017 - 12:55 AM