Hello,
I'm having trouble with MS Access 2007 (running Vista). I have a table with multiple fields, including several text fields containing the links to images relevant to that record. The outcome is a form with multiple images that change with each record.
This works fine, however once I shut the database down and restart, it stops working. I've figured out that it is because i'm only putting in the relative path (image.jpg) rather than the absolute path (c:\temp\image. jpg). The database and images are stored in the same folder. So in the course of shutting down and reopening the database, the images forget where to look for themselves.
Putting the absolute path solves the problem... however I want to eventually put this database on a CD, so putting these absolute paths wouldn't work would it (no longer running off the c drive)?
So, is there a way to make the database recognise it's position and therefore recognise relative file paths? Or another way around this?
Thanks so much
G
An aside... I'm not using attachments, as I want to be able to convert this database to older versions for others to view (however I've only got 2007 to work with).
I can't embed OLE objects since I keep getting a "OLE server may not be registered' error. But from my understanding I'm better off not using this function (I've got >200 images). So I haven't really tried fixing this.
I don't know a lot about codes etc.
5 2919 NeoPa 32,573
Recognized Expert Moderator MVP
CurrentDB.Name has the full path of where the database was opened from.
From this you can extract the folder that the images are relative to.
Does that help?
Yes I think so. I also have come across Application.Cur rentProject.Pat h.
Where do I put this so that it points all the images to the correct path?
Thanks for you help.
OK, I had an idea from something I I saw on another website...
I made a module that says:
-----
Option Compare Database
strFolderName = Application.Cur rentProject.Pat h
-----
I then put text box [txtPath] on the form with the Control Source being
= [Application].[CurrentProject].[Path]
I then have my original text box [Image1] with the image sub folder and file name stored in it.
In the Image control source I've put:
=[txtPath]&[Image1]
This seems to work, however I know I've probable gone round in circles and there must be a neater way of doing it. Next step is to try moving the database.
Also, regarding the above module, do I need to add anything further than this? I don't know anything about modules, but this one just seems to short or something.
Thanks
Gem
I did find a shorter way:
By just putting
=[Application].[CurrentProject].[Path]&[Image1]
in the image control source. Seems to eliminate the need for the module.
It seems to work now, are there any major problems that using this method may cause to my database?
What is the difference between this and CurrentDb.Name?
NeoPa 32,573
Recognized Expert Moderator MVP
I did find a shorter way:
By just putting
=[Application].[CurrentProject].[Path]&[Image1]
in the image control source. Seems to eliminate the need for the module.
It seems to work now, are there any major problems that using this method may cause to my database?
...
This is the neater way of doing it. Doing dynamically (rather than with a module) seems a much better idea.
I never discovered that property of that object before, so I always stripped it from CurrentDB.Name.
...
What is the difference between this and CurrentDb.Name?
Your method is just better :->
I expect I'll be using that from now onwards.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Lee Phillips |
last post by:
I believe it is universally accepted that decorating your
website with images from someone else's, without permission,
is rude and unethical, even if the images are in the public
domain, because to do so is to steal bandwidth.
But I have run across a situation where people are linking
to other types of resources that I offer on my website
without my permission, and I was interested to know if there
is a consensus on the ethics of this...
|
by: Ken |
last post by:
I have a win 2000 database of autographs and scanned photos. They are
in the SAME directory. In the table, my "ImagePath" text field shows
JUST the image name (i.e. "blank.jpg"). I have an image field that
links to the ImagePath field. But it does not display in the form.
I go in and delete the image field and add it back in and link it to
the "blank.jpg" file (its a dummy jpg that says "Not Avail"). Then I
make sure it is linked and not...
|
by: gasturbtec |
last post by:
please help im new at access programming and i just got this project
dropped in my lap because the old programmer quit. i've been doing ok
so far but now i need to add code to an existing database that is used
to connect to other databases and generate reports. below is sample
code of how the database does the linking i hope i give you enough
info to help me but if not let me know and i will give more.
Sub txtShipDataFileSub()
Dim...
|
by: Steven |
last post by:
i want to be able to find jpeg's in a certain directory on my server
and then link them to an id and display them in a form. at present the
table is very basic but i am struggling on how to make this default
directory so that access can find the pictures automatically without
intervention. any help would be greatly appreciated :o)
|
by: chrisse_2 |
last post by:
Hi,
All the records in my database will contain at least one picture. At
the moment all the images are part of the database as ole objects
although the database is way to big and there is only 12 records in it.
I have been reading about linking images into the database and i would
like to use the method linking via code this way the database will be
as small as possible.
| |
by: meyvn77 |
last post by:
Hello -
I am looking for the best way to store images in a Access DB.
My Idea -
I have a table with 150,000 records. These recoreds represent a Crash
(Traffic Accident).
I have 50 different images that represent almost any type of Accident.
Each crash record can be represented by one of those 50 images
(depending on the Crash Data).
I don't want to waste space by having each record have a BLOB field w/
|
by: fauxanadu |
last post by:
Question:
How does one create a relational link to an image in Access? In other words, instead of an image control with a path of "C:/Database Folder/Images/image001.jpg", I want to be able to link to "./Images/image001.jpg"
Technical:
Tables:
tblIndex
numMapID (primary)
numXCoord
numYCoord
|
by: shardy |
last post by:
Hello,
I am trying to create a code repository for myself and am having
trouble linking to files. Basically, the web server computer has
drives from several other computers nfs mounted to it -- and I want to
link to a file (just a .C file) on one of the nfs mounted drives. I'm
an html novice and have tried:
<p><a href="/home/nfs_drive_mount_point/dir/script.C">script.C</a></p>
|
by: tharden3 |
last post by:
Hey Bytes,
The website I'm working on is coming along just fine, and I'd like to thank all of you PHP folks who have been helping me out. I'm almost done with the coding!
I'm trying to get the data-basing code finished with. I've got my products, with lines of text next to it that serve as descriptions. With each of those entries, I have images. I've implemented the code for displaying the text, and I've also implemented the code for the...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
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...
|
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...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |