How load images that are in a folder onto a form

  • Thread starter Thread starter SteveL
  • Start date Start date
S

SteveL

I have a form in Access 2003. The form contains a combo box. When the user
selects a record from the combo box, I want to have up to 6 images load onto
a 2nd tab of the form. The image files are in a specific folder related to
the record they select. In other words, if they select "ABC123" from the
combo box, I want the 2nd tab to load all images that live in a folder named
"ABC123" on the computer. How can I do this?
 
But I can only provide the path to the folder. The folder contains up to six
images. I need all of them to load and display for the selected record. Is
ther a way to "loop" through the .jpg files and load all of them on the form?
 
Each file will need to load in it's own image control, or you will need to
make a collage of the 6 images as 1 composite. When you load the main record
onto the form, you can also fill 6 hidden textboxes with the contents of 6
records in a subform with the 6 paths, by looping through the recordsetclone
of the subform. Name the 6 textboxes like txtTB1, txtTB2, etc. Here's an
aircode stub to get you started:

Dim rst As DAO.Recordset
Dim i As Integer

Set rst = Me.SubformName.Form.RecordsetClone
i = 1
With rst
.MoveFirst
Do Until .EOF
Me.txtTB(i) = !txtPath
i = i + 1
.MoveNext
Loop
End With
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
For some reason I can't make this work. The name of my main form is frmTest.
The name of tab on this main form is "Photos". I created 6 text boxes and
put them on the "Photos" tab which is where I want the images to end up. I
created a on update event on the combo box where the user selects a
record...here is my code. What am I doing wrong?

Dim rst As DAO.Recordset
Dim i As Integer

Set rst = Me.Photos.frmTest.RecordsetClone
i = 1
With rst
.MoveFirst
Do Until .EOF
Me.txt(i) = !txtPixLink
i = i + 1
.MoveNext
Loop
End With
 
Can anyone please help with this?

--Steve



SteveL said:
For some reason I can't make this work. The name of my main form is frmTest.
The name of tab on this main form is "Photos". I created 6 text boxes and
put them on the "Photos" tab which is where I want the images to end up. I
created a on update event on the combo box where the user selects a
record...here is my code. What am I doing wrong?

Dim rst As DAO.Recordset
Dim i As Integer

Set rst = Me.Photos.frmTest.RecordsetClone
i = 1
With rst
.MoveFirst
Do Until .EOF
Me.txt(i) = !txtPixLink
i = i + 1
.MoveNext
Loop
End With
 
Back
Top