Solved

Access 2010 - Link to a web image

Posted on 2015-01-23
9
262 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
  • 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
 
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now