Link to home
Start Free TrialLog in
Avatar of XGIS
XGISFlag for Australia

asked on

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

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

Avatar of IrogSinta
IrogSinta
Flag of United States of America image

Try this:
Me!Image127.PictureData = fullpath
ASKER CERTIFIED SOLUTION
Avatar of nirdeshsingh
nirdeshsingh
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of XGIS

ASKER

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
Avatar of XGIS

ASKER

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

It's My Pleasure :)
Avatar of XGIS

ASKER

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