relative link for background image in report

groengoen

Registered User.
Local time
Today, 12:26
Joined
Oct 22, 2005
Messages
141
I have a report with a background image (watermark).

I have made it a linked image as it makes the report very large. I would like to make the link to the image relative to the current location of the database, rather than an absolute location link. Is this possible?

This would enable distribution of the database to other users, as a complete package.

When I tried a relative location eg. backgrounds\image.jpg I get a message that access "can't open the file". If I use the absolute location, eg. c:\Documents and Settings\.....\backgrounds\image.jpg it works ok.
 
You can assign path in vba on the onOpen event of the report
 
Thanks, that is handy. Is it possible to assign the path to the current directory, without specifically giving the path, because I wouldn't know which directory my users would be putting the .mdb file.

Geoff
 
Use this code on open event of report

Code:
Dim PicturePath as String

PicturePath = left(CurrentDb.Name, InStrRev(CurrentDb.Name, "\", -1, vbTextCompare)) & "\MyPicture.jpg"

me.image0.picture = PicturePath

replace Mypicture.jpg with your picture name
replace image0 with Image control name on report
 

Users who are viewing this thread

Back
Top Bottom