0

I'm a newby to Access and VBA and I have a continous form with an ID field and an empty picture named 'Miniature' on the same row.

To display the pictures for each row, I'm using the FormLoad event

Private Sub Form_Load()
    Me.Miniature.Picture = GetDBPath & "miniatures\" & Format(Me.ID, "000") & ".gif"
End Sub

The pictures are displayed, but it's the same for each row since 'Miniature' is the name for every picture

I also tried RecordSet but the picture is not a field so I don't know how to access it.

I'm searching for a way to accomplish what I want ? What do I need to use ?

2 Answers 2

1

Since I couldn't find a way to set each picture individually I added a new field for my form with the absolute path to the picture and I used the Control Source property.

Anyway, thanks for trying to help

Sign up to request clarification or add additional context in comments.

Comments

0

Update: Using an event won't work (note that any code changes to the picture will result in all instances of the control being updated) so I've removed my previous answer.

The way around this is to change the data source for the table to something like this

SELECT CurrentProject.Path & "\" & "miniatures\" & Format(ID,"000") & ".gif" AS ImagePath, * FROM TableName; 

Then to bind the image to the ImagePath column. This will result in the image being displayed without having to add an actual column to the table.

Keep in mind that doing this for a large table will not be performant as it will result in the evaluated expression occuring for every row

CurrentProject.Path & "\" & "miniatures\" & Format(ID,"000") & ".gif" 

4 Comments

It's a continous form so it doesn't work.. Already tried, the image change when using the arrows, but it's still the same everywhere on the actual form.. :/
Try with ! Perhaps such as me!miniature.picture
Doesn't change anything.. I'm thinking about adding a field and use the control source property of the picture.. But it would be better the way I was trying to do
Found a way to make it work and updated my answer accordingly as you're right, Current event won't work

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.