Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display images on a continuous form that lists jpgs in a folder. 1

Status
Not open for further replies.

diwin

Technical User
Nov 29, 2002
218
CA
I have to rename a couple thousand pics, so I created a form for this. In it there is a subform in continuous view that displays the names of the image files (from a table). I also want to show a thumbnail of each. So far, I get the same pic in all records and it changes when selecting another record. How do I get each image to display in the appropriate records???

Daniel Dillon
O o . (<--- brain shrinking at rate shown.)
 
Thanks Duane.

So I would have to identify the jpgs by looking at the image. Is there then no way to display the images in a continuous list for me to make selections from?

Daniel Dillon
O o . (<--- brain shrinking at rate shown.)
 
Use an unbound form with say 10 or 20 records. Then load the ten/20 images as you cycle records. Have a goto "next 10" button like on a webpage. The other option is put the images in a table. With Acess 2007 and beyond this is far less an issue. Their are 3rd party apps as well.
 
MajP

Thanks for giving me hope.

Can this unbound form be a this unbound form would be a non-linked subform. How do I "load" images into it? Do I use the image control or an unbound ole control? Access 2007 not an option. Using 2003.

Daniel Dillon
O o . (<--- brain shrinking at rate shown.)
 
Lets say you want to display 10 images per "page". You would increment a counter each time you hit the "next page" button.

something like
intCounter = intCounter + 10

dim strSql as string
strSql = "Select Top 10 from someTable where ID not in (SELECT Top " & intCOunter & " ID from someTable"

That will make it appear as if you are picking the next x records.
dim rs as dao.recorset
set rs = currentdb.opendrecordset (strSql)
dim i as integer
do until rs.eof
i = i + 1
me.controls("imageCtl" & i).picture = rs!pathField
rs.movenext
loop

here your image controls are imageCtl1 - imageCtl10
 
I'll give it a go.

So I can fit 20 images on the form, so should I change...

i = i + 1
...to...
i = i + 1
If i = 21 Then Exit Sub



Daniel Dillon
O o . (<--- brain shrinking at rate shown.)
 
in my case I have a select query that at most returns as many records as I have controls so it is not really necessary. However it is not going to hurt.

In my example I open a new recordset each time I "move a page" with as many images as controls. The other way would be to leave a large recordset open and just move around in that recordset reloading the controls. There are efficiency trade offs either way. The big recordset could take a long time to initially open, but then its open. The small (10,20 images) would open faster, but you do that every time you "change a page".

BTW my counter would have to be global to the module.

private intCounter as intger

private sub someControl_click()
intCounter = intCount + 20
'Need some code so you can not go beyond the total
'number of images
call loadImages
end sub
 
Lovely, got it working and added a Prev. button that is disabled at top of list. Had to create intRemainder for that, in case last bunch became not multiple of 20 for some reason.

Thank you very much. Now to get the renaming thing working. Should be okay. I can work with text and basic fso a bit easier than loops and arrays.

Daniel Dillon
O o . (<--- brain shrinking at rate shown.)
 
If you don't really want to recreate the wheel, try one of the many freeware programs that already do this. I usually use IrfanView for bulk renaming / resizing.


Greg
People demand freedom of speech as a compensation for the freedom of thought which they seldom use. Kierkegaard
 
Um .. surely you just need to drop an image control into the detail section, and set its source to the field that contains the filename.
 
Strongman,
Unfortunately even with 2007, that has much improved image capabilities, that does not exist for a continous or even a single record view.
 
diwin,
Another thing you may consider is a listview and the associated imagelist. These are activeX controls that work together, but I have never tried it with lots of images. The imagelist is an activex control that stores images that is its only purpose. A listview or treeview can pull the images from the imagelist and use them. See this example (although a vb implementation)
 
Strongman,
Please provide the details so the rest of know how. I have never heard of this. AFAIK the image control has no source property. A bound control would require the image to be in the database. I do not have 2010 is this some new feature? Is this some new 2010 control. Helps us out here.
 
So I tested on a 2007 machine, and the Bound image control is a 2007 feature. Did not exist in prior versions. The bound image control will allow you to reference a field with a path and render the object. The attachment field will also render the first attachment, MS does not explain if you can render multiple attachments.
 
MajP: so does that allow the behavior I was after?

Daniel Dillon
O o . (<--- brain shrinking at rate shown.)
 
doesn't matter for now. don't have 2007.

Daniel Dillon
O o . (<--- brain shrinking at rate shown.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top