Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / September 2006

Tip: Looking for answers? Try searching our database.

Relative path & image

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ruymán - 29 Sep 2006 18:51 GMT
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.