473,672 Members | 3,899 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Relative path & image

Hello!,

is possible use relative path in access? for example use "photo\image1.j pg"
instead of "c:\db\photo\im age1.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.
Sep 29 '06 #1
2 10415
>is possible use relative path in access? for example use "photo\image1.j pg"
>[...]
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(strDbP ath, "\", , vbTextCompare))

' set the image location
Me.OLEUnbound1. SourceDoc = strDbPath & "MyImage.jp g"

End Sub

Ruymán wrote:
Hello!,

is possible use relative path in access? for example use "photo\image1.j pg"
instead of "c:\db\photo\im age1.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.
Sep 29 '06 #2
You could set the Image's Picture property in the Load event using:

Me!MyImage.Pict ure = 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.

Sep 30 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
10283
by: midwesthills | last post by:
Is there a way to obtain the relative path of an image through javascript? I'm using document.imageName.src right now, and all I get is the absolute path. Thanks in advance for the help!
6
3031
by: David W. Simmonds | last post by:
I know that I can create an Image object by using a path like C:\MyPictures\pic.jpg, but how can I create an Image object by using a path like /MyPictures/pic.jpg where the path is relative to the site. For instance, if the site is http://www.foobar.com, then /MyPictures/pic.jpg would be fully qualified by http://www.foobar.com/MyPictures/pic.jpg. Presumably there is a way to get the fully qualified path by giving the relative path.
6
11761
by: openleren | last post by:
Hi all, how can I use a relative path in my web.config file for an Access db?: Instead of using <configuration> <appSettings> <add key="conAccess" value="microsoft.jet.oledb.4.0;data source=c:/Inetpub/MyApp/data/database.mdb" /> ...
4
7848
by: Win, Pats | last post by:
I have a snippet of HTML that I inject into a number of pages throughout my Web site at runtime. My problem is that I'm not getting the image to appear in all documents into which this snippet is injected. If I specify a document-relative path (e.g., src="../someFolder/AnotherFolder/TheGraphic.gif"), then it works fine, but only for documents that exist at the level in the directory structure. I thought I could use a root-relative...
2
2300
by: Jordan Richard | last post by:
Put another way, is there any way I can tell ASP.NET to convert a path (imbedded in a string variable, "~/images/some_image.gif") to a root-relative path, that the client will understand, for the *current* page request? Here's what I'm doing: I am injecting HTML directly into ASPX pages via LiteralControl. something like this...
0
1082
by: matthias s. | last post by:
Hi there, Say I have a domain called www.mydomain.com. In my virtual directory I've created subfolders called 'sub1' and 'sub2'. Now in 'sub1 resides the file 'file1.aspx' and in 'sub2' resides the image 'img1.jpg'. When specifying a relative URL (to the image) in the file1.aspx I'd go like: <img src="../sub2/img1.jpg" /> and should be fine with it. My problem is, I have a couple of web-controls
19
5080
by: Jerry M. Gartner | last post by:
Greetings: What is the best way to resolve paths within a document regardless of what path it is opened under? For example: I have x.php and it contains <img src="images...">, (amongst other things, like php code), which resolves the correct image path when opened under / but when x.php is read into a file under /dir the image no longer resolves, for obvious reasons. With absolute paths, this isn't an issue but it is with relative...
5
1713
by: gunjangoyan | last post by:
Dear Friends , I am developing a cms like blog. http://domainname.com/blog/cmsindex.php and any template path are like blog/template/template_name/index.php In cmsindex.php i am using following code
0
1782
by: Eric | last post by:
How can I set this property so it works easily both with my unit tests & DAL, as well as on another machine with the same relative directory? My current app.config is below: Please let me know if there is a more appropriate forum to post this to (I posted this to Sql.Ce a dew days ago also). Thanks! ------- <configuration>
0
8419
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8945
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8844
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8642
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8696
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7472
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4239
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4439
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2092
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.