×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Display a Web Image in a Report
2

Display a Web Image in a Report

Display a Web Image in a Report

(OP)
Hi Folks,

THERE MUST BE A WAY TO DO THIS!!

Our organization has images on the web (actually, SharePoint server). I have managed to display the images on a form using a Web Browser Control. However, I cannot figure out how to display a web image on a report. A Web Browser Control does not work on reports; only forms.

I have two fields: one storing the URL path (Http://site/library/), and the other storing the image name. By concatenating the together, I get the entire path.

This should be far easier than it is. The images must stay on the web (per organization policy), so storing locally is not an option.

Ideas? Thank you in advance.

RE: Display a Web Image in a Report

This is because a report IS NOT a web-browser.
Web-browsers can process URLs - reports can't (neither can forms - that's why you embed a 'pretendy' web browser).
You can't do this with ANY OTHER application - why do you expect an MS Access report to do it?

Can you point me to ANY (non-browser) application that enables you to treat a URL path like a physical file path?

As this is a company owned web-site, you have an option of referring to the physical, server file path to the image (that the web-site uses).
This has an advantage of: when the web image changes - so will yours (because the physical file will change).

If there are 'permissions' issues with that, then the company needs to revise it's policy, because it's business processes are failing because of it.
It should be that all images are stored in one place, centrally, and all applications / web-pages access the same images OR, there is a process of storing the same images in multiple locations and maintaining their topicality.

I find that policy to be strange, have you personally read it or has someone 'told you it is so'?
I'd personally find and read the 'policy'.

ATB,

Darrylle




Never argue with an idiot, he'll bring you down to his level - then beat you with experience.

RE: Display a Web Image in a Report

2
>This is because a report IS NOT a web-browser.

So what?

> reports can't [process URLs ]

Sure they can, just not completely natively.

>Can you point me to ANY (non-browser) application that enables you to treat a URL path like a physical file path?

There are plenty - media players, for example.

We can make Access handle an image URL as a displayable file path pretty easily, even on a Report

Simple example

1) Stick an MSForms Image control on your report (we'll assume it is called Image0)
2) Add an event procedure to the OnFormat event for the report section the control is on
3) The code should look like (this is for the Detail section). Note that Report_Load might be a better event to use if you want to see the image in all report views apart from Design View (i.e. layout, print preview and report)

CODE

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Set Image0.Picture = LoadPictureFromURL("http://www.blogcdn.com/www.engadget.com/media/2012/03/nokia-n9-inception.jpg")  SOurce file - this text could obviously come from a field in a table, for example 
End Sub 

4) Create the following function in a module:

CODE

Option Compare Database
Option Explicit


Private Declare Function CLSIDFromString Lib "ole32" (ByVal lpstrCLSID As Long, lpCLSID As Any) As Long
Private Declare Function OleLoadPicturePath Lib "oleaut32" (ByVal szURLorPath As Long, ByVal punkCaller As Long, ByVal dwReserved As Long, ByVal clrReserved As OLE_COLOR, ByRef riid As Any, ByRef ppvRet As Any) As Long

Public Function LoadPictureFromURL(ByVal url As String) As Picture
    Dim IPic(15) As Byte 'holds the IPicture interface
    CLSIDFromString StrPtr("{7BF80980-BF32-101A-8BBB-00AA00300CAB}"), IPic(0)
    OleLoadPicturePath StrPtr(url), 0&, 0&, 0&, IPic(0), LoadPictureFromURL
End Function 

Now print preview your report (after saving it)

RE: Display a Web Image in a Report

Ah - just realised the OP was back in November. SO I guess I was too late to help.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close