Access 2010 - Link to a web image

Hi,

We're using Access 2010 with a SQL backend.  I can generate the full image link path via SQL.  

Ex:  Field ImageLink contains:

https:\\www.Generic.com/zGeneric/productimages\ABC

Item:  ABC

How can I use this link to display the image for item ABC (and possible resize the image if necessary)  in an Access form?  

Thanks,

Karen
PetEdgeAsked:
Who is Participating?
 
Jeffrey CoachmanConnect With a Mentor MIS LiasonCommented:
<Our website's logic also references this same image path, so I do not need to worry about maintenance.>
You may..., ,...when you create this path in Access, it will be hard-coded, ...so then you would need a system to detect when it changed...
...unless I am misunderstanding something.

I'll look at all of this tonight...
Lets see if Nick has something up his sleeve...

Jeff
0
 
Nick67Connect With a Mentor Commented:
My short answer you'd be; 'you can't'
The long answer would be that while you CAN:
1) Get that image from that URL
2) Haul it down and save it somewhere local
3) Resize it in code, and
4) Display it
It'd be a heck of a lot of work for very little payoff.
And if the URL changed, broke or went 404, you'd be in the weeds.

And, you can use a WebBrowser control and display the URL straight-up and it will work well if everyone keeps their default browser as IE11, but you've got some uncontrollable dependencies there.

IS there a compelling reason to do it from a URL?
0
 
Jeffrey CoachmanConnect With a Mentor MIS LiasonCommented:
I have done this by using a web browser control in a form.
I only tested it in Access 2010, and Nick's comments about broken links will still apply.
I don't know what level of sophistication you need, ..but it worked OK for my needs at the time.

Create a text field named something like this: ImagePath
You can drop a webbrowser control on your form and used code like this to display the image, on the current event:


Private Sub Form_Current()
    If Not Me.NewRecord Then
        Me.ctlWebBrowser.Navigate url:=Me.ImagePath
    Else
        Me.ctlWebBrowser.Navigate ("about:blank")
    End If
End Sub

Open in new window


Note that I could not get this to work in a Report

Give this a try and let us know.

JeffCoachman
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
PetEdgeAuthor Commented:
Thank you both for the feedback.  Nick67 - I'll be linking to our own website, on which images will always be available with a particular nomenclature.   We have some 12,000 products, so it would be very helpful to display the image and I'm willing to do the 'heck of a lot of work' (with help, hopefully!).

JeffCoachman - Your code worked nicely to display the image; however, it's displaying at about 5" x 5", and taking up way too much real estate on the page.  

Is there is a way for me to resize the image?
0
 
Jeffrey CoachmanMIS LiasonCommented:
Is there is a way for me to resize the image?
... Unfortunately, No, ...not with a webbrowser control.

The webrowser control will display the image as-is

Even if you could resize the image, your system to do so would have to have the ability to dynamically resize any image to "fit" on the control.
I have see code to dynamically resize images, ...but none to work with a webbbrowser control.
So then you have to follow Nick's outline...
But then you would have to create yet another link to the "stored" images, ...then create another system to "refresh" the stored images.
This code is complex in and of itself.
Couple that with SQL Server, Downloading the image file,...and things can get ugly quite quickly if you are not well versed in coding in VBA and possible some measure of web programming.


Besides, ...as Nick also states, if the link is ever broken, you are out of luck (webmasters will change/remove/Add images all the time, ...now each image change would have to be reported you...?)
Then what? ...Create yet another system to detect what file was changed/deleted/added
...on top of the (Not yet created) existing code?
Moreover, the devil is in the details.:
Are you downloading every image from the site, or just a certain page?
Not all code to resize an image will work with every image type: (jpg, png, bmp, gif, ...etc)
Some images are embedded in other objects...
Besides, ...not all images will "resize" and still "Look Good" on the screen. (some images may be squished to the point of being meaningless, others may be expanded so much that they look too "fuzzy")
(For example, some images are "Padded" with Whitespace)
What's the point of resizing an image if you cannot see it clearly when you do?
...Then what?

Can you take a step back explain the need for doing this to us...?
Perhaps there is a tool already available to do this...

JeffCoachman
0
 
Nick67Commented:
Can you take a step back explain the need for doing this to us...?
Amen that!
I'll be linking to our own website
There may be an entirely good reason why you don't have access to the source images files, and only their URL's
I am not sure what it would be, though.
And having access to the source image files will be much simpler--because most of what I have lined out in the long answer is recreating the source files.

And...

The long answer will be slow, as well
Reaching out to a web site, sucking down an image, and displaying it will take a user-noticeable bit of time, each time, every time.
And I could appreciate that you'd want to be certain to have the Access app display what the web site is displaying.
But reaching out to web site and seeing if a particular file exists is doable.

Talk to us about your operational needs, and constraints
0
 
PetEdgeAuthor Commented:
I do appreciate the time you've both taken to reply.  This is for the team which develops and prices the materials we sell.  

Our website's logic also references this same image path, so I do not need to worry about maintenance.

The team which creates the images does not follow a strict naming convention and images are stored in various places on our network (depending on when new product is introduced).  So the central, clean location to access these, is our website.  

This app might have a max of 15-20 users using it at any time.  Performance seems acceptable at this time, as I scroll through the materials with the existing control.  I.E., I'm not noticing any lag.

This works beautifully in Reporting Services, by the way.
0
 
PetEdgeAuthor Commented:
How about if I copy down the image locally, then display it?  I'm fine with overwriting a prior version.
0
 
PetEdgeAuthor Commented:
Another option would be to copy the images down and store them in a SQL database / share.  I could run the job initially for all images then daily for any new materials which don't have images.  (I have good VB and SQL skills).
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.