Insert .jpg into an access report

Using Access 2010, I want to have a report place .jpg images into a field in a report.

The file and path for the .jpg file is stored in a text field in the report's table.

It works great in a form, but seems more difficult to implement in a report

Thanks
rogerdjrAsked:
Who is Participating?
 
als315Connect With a Mentor Commented:
@hnasr: in my sample field's default value on a form =[CurrentProject].[Path] :)
0
 
als315Connect With a Mentor Commented:
You can use example from my article (Images on continuous forms). There is no difference between form and report in this case.
ImagesTest.zip
0
 
hnasrConnect With a Mentor Commented:
Try this:
Image control record source: =[currentproject].[Path] & "\" & [ImagePath]
ImagesTest-2.zip
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
rogerdjrAuthor Commented:
Both solutions work great

One clarification - when there is no image I want the image box to disappear and the report to compress

I tried both on_print and on_format with this code and neither worked?

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If Len(Trim(Me![CheckListFigureRef])) > 1 Then
        Me![CASpRptImage01].Visible = -1
    Else
        Me![CASpRptImage01].Visible = 0
    End If
End Sub
0
 
Jeffrey CoachmanConnect With a Mentor MIS LiasonCommented:
The LEN() function is not always best to check for "missing" values, ...try this instead:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If Not Isnull(Me![CheckListFigureRef]) Then
        Me![CASpRptImage01].Visible = -1
    Else
        Me![CASpRptImage01].Visible = 0
    End If
End Sub
0
 
hnasrConnect With a Mentor Commented:
check this:
Use the Dir function
ImagesTest-3.zip
0
 
rogerdjrAuthor Commented:
Thanks for the quick response
0
 
hnasrCommented:
Welcome!
0
 
hnasrCommented:
My comments revisited: To display

Form_Load
Report_Load

     Me.Image.Picture = [CurrentProject].Path & "\" & "NA.jpg"

Removed code in Report Detail_Format.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.