 |
| Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

September 3rd, 2003, 06:20 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Web images in Access XP
Does anyone know how I would go about putting an image from the web onto a form, or (preferably) have it as an OLE object type deal that links to an image on the net?
Basically, what I want to do is rather than have the image being something like C:\image.jpg, it should be http://www.mydomain.com/image.jpg
Basically, there's a heap of photos of people on the net, and I'd rather link to those files rather than store the images again.
I don't have FTP access to the server either:(, which would probably be one way around it.
Any ideas?
Steven
I am a loud man with a very large hat. This means I am in charge
__________________
<hr noshade size=\"1\"><i><font color=\"blue\">I am a loud man with a very large hat. This means I am in charge</i></font id=\"blue\">
|
|

September 10th, 2003, 01:07 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
|
|
Hi Steve,
This should work in A2K on up:
1. Create a table to hold your URLs (tblURL).
2. Create a new form, and set the form's record source to tblURL.
3. Add a textbox to the form and set its control source to the field in tblURL that stores your URLs. Name it txtURL.
4. From the Insert menu, select ActiveX Control, then select Microsoft Web Browser. Name the new Web Browser control actx_WebBrowser. You can size the Web Browser control any way you like.
5. Open the VBA IDE and set a reference to Microsoft Internet Controls (shdocvw.dll)
6. Paste the following code in your formâs Current event:
Private Sub Form_Current()
Dim objIE As SHDocVw.InternetExplorer
Dim strURL As String
txtURL.SetFocus
strURL = Me.txtURL.Text
Set objIE = Me.actx_WebBrowser.Object
objIE.Navigate strURL
End Sub
7. Open the form. The site for the first URL listed in tblURL should display. The Web Browser control is even smart enough to connect to the internet if you don't already have an active connection.
Now, as you navigate through the forms record source, the code will read the URL from the textbox, and display the associated Web Page in your Web Browser control.
HTH,
Bob
|
|

September 10th, 2003, 06:42 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
So Bob, how many times today have you been told that you're a genius?
Thanks heaps
Steven
I am a loud man with a very large hat. This means I am in charge
|
|

September 10th, 2003, 08:57 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
|
|
LOL, thanks Steven
Actually, it has a lot more to do with genus than genius, genus Neotoma to be precise; you know, the familiar North American pack rat, those clever little creatures who collect in and around their nests a great variety of small objects. I figure VB objects are as good as any.
Which brings me to a perfect application of the embedded browser concept! I maintain several Access databases of newgroup postings that I find particularly useful, and its always been a bit of a pain toggling back and forth between IE and Access, cutting and pasting. With an embedded browser, I can do my "post harvesting" from a single Access form, which is mighty convenient.
In fact, I just sent this post from an Access app. Clicking the message preview button actually opens an instance of the Wrox message preview dialog independently of my Access form, just as though it were part of Acces's Multiple Document Interface. Kinda' cool. Thanks for thinkin' outside the box. Oh, the control does seem to have some sizing issues. Seems to be maxing out in about a 6" square at the moment. Have to play with that a bit.
Regards,
Bob
|
|

September 10th, 2003, 11:13 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I'll admit, that the sizing issue is, well, an issue, but the way I got around it was this (and don't ask me why it works - it just does)
Insert the ActiveX control, and resize it straight away, befor you do ANYTHING else to it - then it resizes ok. It's rather annoying, as I had to keep deleting and inserting the control while I previewed it to make sure that it was just right.
Doing things other than just making plain old databases, like putting this functionality in, sure does make my job a lot more fun
And just so that I can test this pop up window thing - I'm also posting this reply from Access
One slight problem I've noticed with it, in terms of posting however (and this may be just a local issue), is that pressing Enter does nothing - So in order to get these line breaks happening, I'm having to paste them in.
Steven
I am a loud man with a very large hat. This means I am in charge
|
|
 |