Solved

Why wont my image display image in MS Access 2003 Report?

Posted on 2013-02-06
6
947 Views
Last Modified: 2013-02-07
I am trying to display a 10 separate databound file based images in an access report.  The image name is stored in the field. The type of image is JPG. I have created a bit of VBA to find the image but it fails to display. My verbose code is as follows;

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

Dim strImagePath As String
Dim imagename As String
Dim fullpath As String
imagename = "image009.jpg"
strImagePath = "../App_Images/Site/Image3/"
fullpath = strImagePath & imagename
Me!Image127.Picture = fullpath

End Sub

Open in new window

0
Comment
Question by:XGIS
  • 3
  • 2
6 Comments
 
LVL 29

Expert Comment

by:IrogSinta
ID: 38862706
Try this:
Me!Image127.PictureData = fullpath
0
 
LVL 3

Accepted Solution

by:
nirdeshsingh earned 500 total points
ID: 38862726
Replace your backslash with forward slash if you are using your image from local computer.
Like : "strImagePath = "..\App_Images\Site\Image3\"

If still does't work then

Edit your path with "strImagePath = "..\App_Images\Site\Image3"
imagename = "\image009.jpg"

If you are on network, please check your path.

For load picture eg:-
    pic =fullpath
    Image1.Picture = LoadPicture(pic)

PS : First try the first solution, if that also doesnt work then send me the code detail and let me know that where you want to show the picture!!
0
 
LVL 7

Author Closing Comment

by:XGIS
ID: 38862917
Thanks nirdeshsingh. The back slashes were the main issue. Other issues were the event, which should have been Detail_Format. Lastly the change of ! to . and it worked. Awesome!

Unfortunately IrogSinta your solution required a dib file, but thankyou for the input.

I will try the alternate logic for network connection and delivery. MS has some worked functions for this that may be useful to determine online/offlibe status etc.

Thankyou
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 7

Author Comment

by:XGIS
ID: 38862922
Solution Code
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim strImagePath As String
strImagePath = "..\App_Images\Site\Image3\" + Me.Image3
Me.Image127.Picture = strImagePath
End Sub

Open in new window

0
 
LVL 3

Expert Comment

by:nirdeshsingh
ID: 38862972
It's My Pleasure :)
0
 
LVL 7

Author Comment

by:XGIS
ID: 38866131
If that code does not work for you and you are operating locally this code may be better as the relative paths had issues. The PC is Win7 64x and the files reside in an IIS7x .NET4 website.  Security may be an issue also if drive content has been migrated from another NTFS.  

This code successfully displays 2 images in an MS Access 2003 Report without error logic.

Private Sub Detail_Format(Cancel As Integer, PrintCount As Integer)

Dim strImagePath1 As String
strImagePath1 = "E:\Websites\XGIS\X.COM\X.COM\App_Website\App_Images\Site\Image1\" + Me.Image1
Me.imgImage1.Picture = strImagePath1

Dim strImagePath3 As String
strImagePath3 = "E:\Websites\XGIS\X.COM\X.COM\App_Website\App_Images\Site\Image3\" + Me.Image3
Me.imgImage3.Picture = strImagePath3

End Sub

Open in new window

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

679 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