Microsoft
Software
Hardware
Network
Question : Linking images to access database
Hello Experts,
I have what I hope is a simple problem to solve in Access 2000.
I have a database that I would like to display images in. (I recently deleted all the images out of the database becuase it was getting too big).
Each record has a record ID, and all the images I want to display are stored in C:\valuations\
Not every record has an image, but all the images follow a naming format of
.jpg
So record 1234 has an image 1234.jpg
Is there some way I can link the image to the record to display it on the form and in the report (one record per report).
There are two outcomes I would like...
1) To be able to set up a default path to the file for each record so I dont have to manually link each file to each record. If the image is present it will automatically load.
2) To only have the image location/path stored in the database and to have it load 'as required' for viewing and printing purposes (i.e. not stored in the database).
I am a bit of an Access know-nothing so some detail would be appreciated.
Thank-you,
Chris.
Answer : Linking images to access database
Well if your image is to be named after the record id then I guess you dont need to store the path of the image
You can do this
assuming you have a bounded form and you are moving thru your records
On that form you have a image control, plus the ID of the record is on the form (can be hidden)
On form current u can add this
private sub Form_Current()
Dim sFile as String
sFile = IMAGE_DIR & Me.ID & ".jpg"
if Dir$(sFile) <> "" Then Me.myImg.Picture = sFile else Me.myImg.Picture = ""
End sub
IMAGE_DIR is a constant that u define in a module
e.g.
public const IMAGE_DIR = "C:\Valuations\"
myImg is the name of the image control
Random Solutions
python and looping trough dates
can't re-link split database tables
How is the local port number allocated when connecting to a remote server via ssh
Repair of jpeg files
firewall using libpcap and raw socket
Problem using an if statement with a php variable in Flash - Part 2
IIS 5.1 and XP Pro, Virtual Domains...
SBS 2003, Exchange, deleted email, want to recover both user and email folder. how to do this...
Can´t send mail got this error: 5.5.0 smtp;573
Casting integer into date value within dynamic sql string