Relative Path

P

polparrot

I have a database that will be run on a server as well as individual laptop
computers. I am using several pdf and pic files with this database. I have
set the default directory on the desktop machines to the directory on the
server (r:) and the laptops to c: The remainder of the path is the same.
example: r:\aaa\bbbb\cccccc.pdf and c:\aaa\bbbb\cccccc.pdf.

I am using one-to-many relationship tables such as:
table1 has a field called controller
table2 has controller, controller_manual and controller_pic.
The conroller_manual field has the path and pdf name (\aaa\bbbb\cccccc.pdf)
and the conroller_pic has the path and jpg name (\aaa\bbbb\cccccc.jpg). On a
form I am using the OnCurrent event to populate the sourcedoc of an OLE
object (for the pdf) and the Picture on the image control (for the jpg) with
the pathes from table2. When the form is running, it get an error from adobe
acrobat stating "There was an error opening this document. The path does not
exist." However the jpg is displayed in the image control.

I have tried putting the complete path (r:\aaa\bbbb\cccccc.pdf) into table2
and it works OK however I do not want to have to make changes to the table2
data when the database is put on the laptop to run.

Does anybody have any suggests. I'm starting to pull my hair out!!!!!

Thanks,
Polly
 
P

polparrot

Use Len(Dir(Trim(YourPath))) > 0 to test wether the file exists before
assigning it to Acrobat or your image control.

mfG
--> stefan <--

Stefan,
Thanks for responding so quickly. I tried adding the code above. My form is
definately not finding the file. Here is my problem:

In table2 field controller_manual,
if I have the data r:\aaa\bbb\cccc.pdf the program works correctly and finds
the file.
if I have the data .\aaa\bbb\cccc.pdf the program does not find the file.

I want to use the relative path, not the absolute path.

Any other suggestions,

Polly
 
P

polparrot

To help further, here is the code I am using:

If Len(Dir(Trim(Me.[controller manual]))) > 0 Then
Me.OLEManual.SourceDoc = Me.[controller manual]
Me.OLEManual.Visible = True
Me.OLEManual.Action = acOLECreateLink
End If

The debugger seems to be stopping on the acOLECreateLink action
 

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