Images load from folder

M

Matt Roell

I'm working on a database in Access for a client. They made the db to display
client information. Each client has 5 images that needs to be displayed. Here
is the issue; there are over 900 records with 4 images each (about 3600
images total) the images are in a table as an attachment, which caused the db
to get very bloated. All the images are also stored in a folder on the
computer with the format “client_1_a.bmp†and “client_1_b.bmp†so on and so
forth. Is there a way to have Access load the images from the folder (I’m
guessing that the “On Load†event need to be used) by searching the folder
for the “client#_image#.bmp†and displaying each image in a specific place on
the form. All that I've seen is for the images to be linked by name and
location in another table, but to do that for 3600 images is not realistic.

Thanks in advance
 
J

Jack Leach

This can be done fairly easily, assuming that in the record for each client
you have stored whatever identifier will make the filename you need.

The practice is to use an unbound image frame control (in your case, 5 of
them), with the Image Type set to Linked (not Embedded). And in the Current
event (whenever the record changes), you update the .Picture property of the
image control with the path of your image.

So, lets assume that you have a numeric field ClientID, and you have a
ClientImage folder in the same location as your frontend, unbound image
controls named Img1, Img2, Img3 etc, and you want to update the 5 images each
time a record (client) is changed...

(aircode)
Private Sub Form_Current()
Me.Img1.Picture = CurrentProject.Path & "\ClientImg\" & _
"Client" & Trim(Str(Me.ClientID)) & "_1.jpg"
Me.Img2.Picture = CurrentProject.Path & "\ClientImg\" & _
"Client" & Trim(Str(Me.ClientID)) & "_2.jpg"
'etc etc
End Sub



You'll want to provide proper handling for Nulls in ClientID (for new
records), and likely you'll store the images in a server/backend folder, but
the above should give a general idea how to handle the situation.

hth


--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top