Link to home
Start Free TrialLog in
Avatar of Nicola Siotto
Nicola SiottoFlag for United Arab Emirates

asked on

MS Access 2010 - Display an image which changes according to the record

I have a form which displays multiple fields. One of this is called [Record_Nr].
For each record I have a corresponding image that I scan and it is saved in a PC directory and contains the same number of the record. So I'd like the displayed record to have an image that changes as soon as the record changes.

I.e. if the record is numbered 000001, then there has to be a corresponding image in a folder: "C:\Users\MyPc\Works\Image_000001.jpg" and the same should display in the form and as soon as I'd go to the next record the displayed image would change accordingly. Of course the image is not stored in the database but just linked.

I know this is possible as I have done it many years back. I just don't recall how I did so.

Any help? Thanks.
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

use the Attachment data type,
see the article from this link http://www.cimaware.com/resources/article_135.html
Avatar of Rgonzo1971
Rgonzo1971

Hi,

Pls try in then  Form's Current event:

Me!ImageName.Picture = "C:\Users\MyPc\Works\Image_" & Me![FieldName]=  & ".jpg"

Open in new window


Regards
Personally I'd stay away from the attachment type.

While it's easy to use, it also prevent you from easily up sizing to SQL server in the future if you need to (an attachment datatype is specific to Access and is used no where else).

Use an image control on the form and update the picture property with the OnCurrent event as Rgonzo1971.

This is exactly what the image control was introduced into Access for.

Jim.
ASKER CERTIFIED SOLUTION
Avatar of als315
als315
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Nicola Siotto

ASKER

Dear Rey, I'd like to avoid using any field as I am utilizing sharepoint. Thanks.
I am looking at both the solutions pointed out by Rgonzo1971 and by als315.

Rgonzo1971
The formula you have suggested where should it go? In a bound or unbound or default image? Please specify.

als315
I am now trying the test MDB to see how it works and to see if it's easy to integrate on my work.
als315, your solution is the closest to solve my issue.

Question:
The current path is where the Access database is located, while the images are in a different directory, but above and not within the same directory of the mdb file. Within the formula is there a way to remove the last specified directory and add another one? If so this might solve my last obstacle and would obtain exactly what I need. Thanks a lot.
<<als315, your solution is the closest to solve my issue>>

 It should be pointed out that Rgonzo1971 gave you the same solution first; Use an image control and set the .picture property to the path.

 While it doesn't offer the detail the article does, it is the same answer.

Jim.
Jim: you can not use code at all and article show sample
nsiotto: there is separate field for path to images in sample. You can remove it and use full path to each image. Just replace
=[Path] & "\" & [ImagePath]
with
=[ImagePath]
I know I can paste "--" the full path.
Since we are accessing from different location from different PC this would have helped a lot in order not to rewrite the path in each different PC/Location. This is the reason for my question.
Is it sharepoint web database or it is splitted multiuser DB?
MS Sharepoint web database.
But tables are linked into a local installation of MS Access 2010
I have done some adaptation and this solution suited my needs as it caters the need to adapt the path even if the program is run from different machines and location. Thanks.