?
Solved

Access 2010 - Link to a web image

Posted on 2015-01-23
9
Medium Priority
?
273 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 501 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 999 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 999 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month12 days, 20 hours left to enroll

777 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