It's a good idea to only store the filename in the database (or the varying part of the relative path,
if the images are stored in multiple directories), then construct the full path at runtime when you need
to display the image. If the images are stored in a subdirectory of the database location you can obtain
the path to the database using code then build the full path to the image - then the images will be found
whether the database is accessed on a local drive, via a mapped share, or via a unc path, without needing
additional configuration.
The following article describes how to get the path to the database, including a method to get the path
to the back-end in a split design (see option 3):
http://tinyurl.com/y3vzzp
This article discusses using relative paths in more detail:
http://tinyurl.com/ylvvsk
And this article shows how to parse the filename from a full path:
http://tinyurl.com/2svnog
Sample code for using an image control on a form is as follows (watch for line wrap - see the code in the
articles above if in doubt):
'Filename' is a field containing the filename (only).
'Image1' is an image control.
'tblLinked' is a linked table in the back-end database.
The image files are stored in a subdirectory 'images' relative to the location of the back-end.
Private Sub Form_Current()
Dim ImagePath As String
ImagePath = GetImagePath & [Filename]
If Len([Filename]) 0 And Len(Dir(ImagePath)) 0 Then
Image1.Picture = ImagePath
Else
Image1.Picture = ""
End If
End Sub
Public Function GetImagePath() As String
GetImagePath = GetDBPath & "images\"
End Function
Public Function GetDBPath() As String
Dim strFullPath As String
strFullPath = Mid(DBEngine.Workspaces(0).Databases(0).TableDefs( "tblLinked").Connect, 11)
GetDBPath = Left(strFullPath, InStrRev(strFullPath, "\"))
End Function
najimou <ij********@hotmail.comwrote:
>Hi everyone
I will be having a split database, running on 2 computers via mapped
drive.
computer "A" will have one front end and the back end located in c:
\mydatabse
2 tables have links to many images stored as c:\mydatabse\images
\images.jpg
so computer A has no problem accessing the picture
computer B will be mapped to the database folder on computer A as
drive G
how is it possible for computer B to link to the images, as his front
end will be looking for images on drive C
keeping in mind the images are changing all the time but always in the
same folder
I have not done this before, and read few posts which none I found
could solve my problem
any directions will be appreciated