Linking Images to records

Researcher

I.T. Veteran
Local time
Today, 01:44
Joined
Oct 11, 2006
Messages
42
I have setup a form that has links to images stored in a folder and the path to those images listed in a table and it works good, however my question is the data I am linking images to is a text field in the tbl called part number. When i enter another record into the tbl that has the same part number I want to be able to see that same image without having to enter the image path into the tbl each time I enter another part number. How can I do that?

I am thinking perhaps some VBA code that stores variables, but I need some help on how to put it all together, any thoughts, ideas or suggestions are welcome...:banghead:
 
use the part number as the name of the image and set the image control with something like
Code:
"C:\thePath to the image folder\" & [yourPartNumberField] & ".jpeg"
 
Last edited:
Using the method described by moke123, there is no need to store the image address in a table of your database.

If now for whatever reason you can't or don't want to rename your images you should think about a new table having at least 2 fields, 1 being the part number and the second being the file name (a third fields for a key is usually good practice).
This will require you to create a new association every time a new (unique) part number is created...

The first reply is to me the easiest approach, if you then have a broken link displayed in your form, it means that you don't have yet an image for the part number.
 
Thank you both for the recommendations, on my form I have the image box and I am setting it's control source under the data tab to:
=c:\icsdb\pictures" & [part number] & ".jpg"

But it does not display anything on the image box...Am I using the correct control source? Also am I using the field name [part number] in the syntax or the actual filename [x950x2mg.jpg] inside the brackets?
 
You could download the example I posted at:
https://www.access-programmers.co.uk/forums/showpost.php?p=1532112&postcount=11

The screengrab shows an example:
attachment.php
 

Users who are viewing this thread

Back
Top Bottom