Solved

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

Posted on 2013-02-06
6
901 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

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.

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
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…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

744 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

14 Experts available now in Live!

Get 1:1 Help Now