Solved

Access 2010 - Link to a web image

Posted on 2015-01-23
9
270 Views
Last Modified: 2015-04-14
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
0
Comment
Question by:PetEdge
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 26

Assisted Solution

by:Nick67
Nick67 earned 167 total points
ID: 40567373
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
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 333 total points
ID: 40567801
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
 

Author Comment

by:PetEdge
ID: 40570411
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 40570915
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
 
LVL 26

Expert Comment

by:Nick67
ID: 40570953
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
 

Author Comment

by:PetEdge
ID: 40575358
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
 

Author Comment

by:PetEdge
ID: 40575366
How about if I copy down the image locally, then display it?  I'm fine with overwriting a prior version.
0
 

Author Comment

by:PetEdge
ID: 40575383
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
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 333 total points
ID: 40576276
<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

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
.NET Redemption/Outlook Examples 3 29
Handle Apostrophes in SQL Parameter 16 66
Tabbed form question 5 17
Javascript function 3 10
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question