A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Relative Path does not work for displaying JPEG Images



 
 
Thread Tools Display Modes
  #1  
Old September 4th, 2005, 07:28 PM
John Miller
external usenet poster
 
Posts: n/a
Default Relative Path does not work for displaying JPEG Images

I am new to Access and know little about VBA Code, but I have a DB with 2000
records and each one needs a different JPEG. I cut and pasted the VBA Code
form the MS Northwind example. I then tested it using some pictures, some
were Absolute pathe, some were in the same dir as the DB and the rest one
directory deeper so I used relative path (sspics\picture.jpg). When I open
up the form to use it the images that are Absolute Path or in the samer dir
as the DB show up just fine, but the relative path ones do not.

If I go to Form design mode reselect a Picture in the ImageFrame Properties
Box (ir forces you to select a picture using absolute path), and then save.
All the images start to work, incliding the relative path ones. That is
until you close the DB and reopen it.

Any ideas, suggestions on how to fix this? It's as if it cannot resolve the
path of the DB so relative path does not work or something.

BTW, In the MS Example on how to do this
(http://support.microsoft.com/default...b;en-us;285820), I followed
all the directions, but in the section on using the custom function in a
form, they tell you to point to a picture for the "Picture" property.... what
is the purpose of this, as this is not the one ever displayed, the one from
your record in the DB is what is displayed?

Image Control
---------------------------------
Name: ImageFrame
Pictu "C:\Windows\Zapotec.bmp"

Does it matter what this picture is or where it is?

Thanks to anyone that can assist a VBA Clueless person to get this solved.

John Miller
  #2  
Old September 5th, 2005, 04:59 PM
Mark Hone
external usenet poster
 
Posts: n/a
Default

Hi John,

I don't think you can use relative paths as such. You need to work out
where you are and supply your code with the complete path. You can do this
by using the Access object model as follows:

myPictureFileName = Application.CurrentProject.Path & "\sspics\picture.jpg"

Hope this helps,

Mark


"John Miller" wrote:

I am new to Access and know little about VBA Code, but I have a DB with 2000
records and each one needs a different JPEG. I cut and pasted the VBA Code
form the MS Northwind example. I then tested it using some pictures, some
were Absolute pathe, some were in the same dir as the DB and the rest one
directory deeper so I used relative path (sspics\picture.jpg). When I open
up the form to use it the images that are Absolute Path or in the samer dir
as the DB show up just fine, but the relative path ones do not.

If I go to Form design mode reselect a Picture in the ImageFrame Properties
Box (ir forces you to select a picture using absolute path), and then save.
All the images start to work, incliding the relative path ones. That is
until you close the DB and reopen it.

Any ideas, suggestions on how to fix this? It's as if it cannot resolve the
path of the DB so relative path does not work or something.

BTW, In the MS Example on how to do this
(http://support.microsoft.com/default...b;en-us;285820), I followed
all the directions, but in the section on using the custom function in a
form, they tell you to point to a picture for the "Picture" property.... what
is the purpose of this, as this is not the one ever displayed, the one from
your record in the DB is what is displayed?

Image Control
---------------------------------
Name: ImageFrame
Pictu "C:\Windows\Zapotec.bmp"

Does it matter what this picture is or where it is?

Thanks to anyone that can assist a VBA Clueless person to get this solved.

John Miller

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Absolute vs Relative path K2H General Discussion 1 June 15th, 2005 02:54 PM
Linking tables to a relative path Paul Database Design 1 December 14th, 2004 10:20 AM
How to link a movie clip to play in the slide with a relative path Jonathan Powerpoint 1 October 4th, 2004 10:40 AM
Picture on a form: Using a relative path Name Using Forms 4 September 8th, 2004 07:15 AM
Link field, with relative path Snoop General Discussions 0 August 30th, 2004 10:59 AM


All times are GMT +1. The time now is 11:59 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.