Linking to JPEG files

D

David Soderstrom

I have written an Access application that creates a report
that includes pictures stored as JPEG images. The data
source for the report is a table (Printed Packing List
Data) that gets refreshed and loaded each time the report
is run. The pictures are linked to an OLE Object field in
the table using the following code before the report is
opened:



MyFolder = "W:\JPEG"
Count = DCount("*", "Printed Packing List Data")
DoCmd.OpenForm "Get Pictures", acNormal
For I = 1 To Count
If Left(Forms![get pictures]![item no], 1) = "S"
Then
DwgItem = Trim(Right(Trim(Forms![get pictures]!
[item no]), Len(Trim(Forms![get pictures]![item no])) - 1))
Else
DwgItem = Trim(Right(Trim(Forms![get pictures]!
[item no]), Len(Trim(Forms![get pictures]![item no]))))
End If

MyFile = Dir(MyFolder & "\" & DwgItem & ".jpg")

If Len(MyFile) <> 0 Then
MyPath = MyFolder & "\" & DwgItem & ".jpg"
Else
MyPath = MyFolder & "\" & "NoImage.jpg"
End If

Forms![get pictures]![OLEFile].Class
= "Paint.Picture"
Forms![get pictures]![OLEFile].OLETypeAllowed =
acOLELinked
Forms![get pictures]![OLEFile].SourceDoc = [MyPath]
Forms![get pictures]![OLEFile].Action =
acOLECreateLink

If I <> Count Then
DoCmd.GoToRecord acDataForm, "Get Pictures",
acNext
End If
Next I

DoCmd.Close acForm, "Get Pictures"



The form "Get Pictures" is based on the table "Printed
Packing List Data" which contains the OLE Object field.

This application works perfectly on my development
machine, but when I package it and distribute it to other
users it does not. The code runs without any error
messages but they end up with no pictures on the report.
It seems like the links to the JPEG files are not
happening.

I am using Office XP Developer to develop the program and
package the application.
 
T

Tony C

I notice that you are using a drive letter as a reference
to a location (W:\). If other users are not using this
Drive Letter, or other users "W:\" points to a different
location, then this is the problem.

Instead of using W:\, try using the
syntax "\\MyServer\ServerSharedDrive".

HTH


Tony C.
 

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

Top