Hello!,
is possible use relative path in access? for example use "photo\image1.jpg"
instead of "c:\db\photo\image1.jpg", I try it but I cann't, but in Visual
Basic if is possible.
Other question but relationated, Is posible don´t put a path to the picture
in the image control (in desing) ?
The Database will be move frecuntly and it will give error in the form load
because the path to the image change, for this I'm making these questions.
After of load of the form I load the pictures for code using
currentproject.path and I don´t have problem with this.
I thought that to capture the error would be the solution, but the error
message is produced it before of the load form event.
Thanks a lot.
Gord - 29 Sep 2006 22:42 GMT
>is possible use relative path in access? for example use "photo\image1.jpg"
>[...]
>I thought that to capture the error would be the solution, but the
>error message is produced it before of the load form event.
Yes, that seems to be the case with the Image control. You might have
better luck with an Unbound OLE Object control that is linked to the
original location of the image when the control is added. I tried that,
and the following works for me when I move the files to a new location:
Private Sub Form_Load()
Dim strDbPath As String
' get current database filespec...
strDbPath = CurrentDb.Name
' ...and just take the path
strDbPath = Left(strDbPath, InStrRev(strDbPath, "\", , vbTextCompare))
' set the image location
Me.OLEUnbound1.SourceDoc = strDbPath & "MyImage.jpg"
End Sub
> Hello!,
>
[quoted text clipped - 14 lines]
>
> Thanks a lot.
Jamey Shuemaker - 30 Sep 2006 06:19 GMT
You could set the Image's Picture property in the Load event using:
Me!MyImage.Picture = CurrentProject.Path & strImage
Where strImage = "\ImageName.ico"
Or you could just set the PictureType property to Embedded. If this
setting is used, it won't matter where you move the database, so long
as the image itself does not depend on user input or other dynamic
events.