ActiveX Control webbrowser

  • Thread starter Thread starter kiwi-com
  • Start date Start date
K

kiwi-com

Guest
Attempting to load a web page objects contents from within ACCESS DATABASE FORM.

within ACCESS FORM I inserted
ActiveX Control called "Microsoft WebBrowser" and named it WebBrowser0


two buttons called:-openPage and getobjectvalue

and a TextBox called MyMessage

the code that sits behind them looks like this:-

' on clicking this button the WebBrowser window will load with the page
Private Sub openPage_Click()
Me!WebBrowser0.Navigate "http://localhost/objectpage.asp"
End Sub


' once you have opened the web page clicking this button should achieve the result but I cant get it to work
Private Sub Getobjectvalue_Click()
' Me!MyMessage = Me!WebBrowser0.Document.location ' this works
' Me!MyMessage = Me!WebBrowser0.Document.body.innerHTML ' this works
Me!MyMessage = Me!WebBrowser0.Document.body.myObject.message 'this Fails

End Sub
....

Ok hope you are with me so far?

objectpage.asp looks like this!
...........
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript">
var myObject

myObject = new buildObject("Hello access-programmers!");
function buildObject(message)
{
this.message = message;
this.message2 = "its built!"
}
var myVariable = "hello from A variable"
</script>
</head>
<body>[/I]
Has the Object built? (<script language="javascript">document.write(myObject.message2);</script>)<BR>
<form name="myform1" method="post" action="">
<input name="myfield1" type="text" id="myfield1" value="Hello from a Form">
</form>
</body>
</html>
.................
(Yes I know there is no need for an ASP page but it will be when live)

Now the Question is How can I load MyMessage with the contents of MyObject.message
(I managed to load it with "hello from a Form" with
Me!MyMessage = Me!WebBrowser0.Document.myform1.myfield1.value

Any help would be greatly appreciated!

Phew! Thanks in anticipation
 
I've attached a nasty hack that might be useful

Me!MyMessage = Me!WebBrowser0.Document.myform1.myfield1.value

That's neat. I didn't know this was an option. Thanks.

I'm guessing you want to get hold of values from input boxes without having to know their names.

To do this nicely, you'll probably need to reference an Active Server Page .dll in your code. This should expose the right object models or whatever, and you'd be able to drill down and get what you want.

I don't have the right stuff installed on my machine, so I'm not sure. Instead tend to use pretty nasty hacks to get the info I want. I've attached a zip file with one of these.
 

Attachments

I'm just wondering what kind of hacking can you do with this???
 
Next Step : How to Fill in the Extracted fields & Re-Display page.

Adam & Kiwi,
I downloaded the nasty hack & it is really great!
But one question:
----------------
How do I add "real" values back to the HTML from my tblCust fields?
----------------
For example: I loaded a webpage that includes Form entry text boxes.
- I click on InnerHtml & see the code
- Then I click GetValues2 & see the Form entry Text fields
acctNum:
businessName:
firstName:
lastName:
- How do I "paste" or pull my own values into this InnerHtml code, and then tell the webbrowser object to display the page again, which now should have the Form entry fields filled in?

Thanks again for some very slick code on extracting the Form fields.
I now hope to learn how to make it Auto-Fill the Form fields....

That would be very useful!
Thanks in advance for your help!
jlig
 

Users who are viewing this thread

Back
Top Bottom