Showing pictures in Report

  • Thread starter Thread starter Caglar Tukel
  • Start date Start date
C

Caglar Tukel

I have a field called ProductImage, and I keep filenames of pictures
such as abc.jpg. I copied all the pictures to the same folder as access
file.

When I tried to use following script. ImageFrame is unbound image object.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
[ImageFrame].Picture = ProductImg
End Sub

I get "Cant open the file 'sample.jpg'. error i Also used
Me![ImageFrame].Picture = Me![ProductImg] but I got the same error.

How can I make picture showed up in reports?

Any help is highly appreciated.

Caglar Tukel
 
You need the full path to the picture. If they are in the same folder as the
database, you might use something like this:

Function GetDBPath() As String
Dim strFullPath As String

strFullPath = CurrentDb.Name
GetDBPath = left$(strFullPath, Len(strFullPath) - Len(Dir$(strFullPath)))

End Function

Then you can use:

[ImageFrame].Picture = GetDBPath() & ProductImg
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top