Results 1 to 12 of 12
  1. #1
    Join Date
    Nov 2004
    Posts
    64

    Unanswered: Display multiple images on a form

    Hi all,
    I have a database with 1 table, the table is used to hold jpeg images. Each of the images has a category ie Cars, Trains, motobike etc etc. I have a query with a search criteia that asks me to choose a category ie[cars].
    Now what I would like to do is display all the cars images on my form side by side. Does anyone know how I can do this or even if Access2k will let you do this?
    I would appreciate any feedback whatsoever.
    Thank you.

  2. #2
    Join Date
    Apr 2004
    Location
    outside the rim
    Posts
    1,011
    By "side by side" do you mean "in a row, left to right"?

    Access doesn't let you create a form that displays records in columns from left to right, but it does let you do that with reports.

    So, to answer your question
    if Access2k will let you do this?
    the answer is yes and no.

    You could probably rig up a form to accomplish it, but it would require some serious coding. Forms are setup to have each individual record span the width of the detail section.

    The report, on the other hand, would be easy by setting the columns property of the page setup, and the report will even group by category for you.

    good luck,
    tc

  3. #3
    Join Date
    Nov 2004
    Posts
    64
    Thanks TC.

  4. #4
    Join Date
    Nov 2004
    Posts
    64
    Just a thought but I have noticed the 'Kodak Image Thumbnail Control' from the Insert activex control menu, has anyone ever used this? it looks very similar to the Image control in VB that could be just what I am looking for???.

  5. #5
    Join Date
    Mar 2004
    Location
    belgium
    Posts
    290
    Well i build some thing like your wish, but used the filescollection, i think you can alter it easily for your sql selection.

    here is the piece of the code :

    Sub CollectFiles()

    Dim nI As Long
    Dim nAantFiles As Long
    Dim nFotTel As Long
    On Error Resume Next
    nFotTel = 0
    nI = -1
    Dim fs, f, f1, fc, s
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFolder(psMainPath & psFolder)
    Set fc = f.files

    nAantFiles = f.files.Count - 1
    Me!TbAantBest = nAantFiles ' show the number of found files
    For Each f1 In fc
    nI = nI + 1
    If nI = pWhereAmI Then
    nFotTel = nFotTel + 1 ' Counter for the max number of image fields on the form
    pWhereAmI = pWhereAmI + 1
    Me("imgPic" & Trim(Str(nFotTel))).Picture = psMainPath & psFolder & f1.Name
    Me("tbPicName" & Trim(Str(nFotTel))) = f1.Name
    Me("tbPicNr" & Trim(Str(nFotTel))) = pWhereAmI - 1
    If nFotTel = 16 Then ' max imagefields on the form = 16
    Me!cmdVolgende.Caption = "Next row"
    Exit For
    End If
    If nAantFiles + 1 = pWhereAmI Then
    pWhereAmI = 1
    For nI = nFotTel + 1 To 16 ' clear the not used imagefields on the form
    Me("imgPic" & Trim(Str(nI))).Picture = ""
    Me("tbPicName" & Trim(Str(nI))) = ""
    Me("tbPicNr" & Trim(Str(nI))) = ""
    Me!cmdVolgende.Caption = "Start"
    Next nI
    Exit For
    End If
    End If

    Next f1

    On Error GoTo 0
    End Sub

  6. #6
    Join Date
    Nov 2004
    Posts
    64
    Wow.... Thanks for this, Where exactly would I place the code?.
    Many thanks,
    Franki

  7. #7
    Join Date
    Nov 2004
    Posts
    64
    Hi E, I have looked through the code but i cant make sense of it? what do the references imgPic, tbPicName and tbPicNr refer to? What kind of image control would I place on my form and what name would I give it? questions, questions??
    Thanks

  8. #8
    Join Date
    Mar 2004
    Location
    belgium
    Posts
    290
    imgpic = imageobject
    tbpicname = textbox for the name of the picture
    tbpicnr = textbox with a number corresponding in this case to a number of the files collection
    I have placed it as follows

    Private Sub cmdWhatEver_Click()
    Call collectFiles
    End Sub

    and in the OnLoad event of the form place pWhereAmI = 1, where pWhereAmI is a public variable for this form.
    Attached Thumbnails Attached Thumbnails screenshotDesignmode.jpg  

  9. #9
    Join Date
    Nov 2004
    Posts
    64
    Hi Emiel,
    I'm really struggling with this one, I just cant grasp your concept.
    I appreciate the work you have done but my brain is acting a bit thick!
    Any chance you could post me the form and code that you have wrote so that I will be able to understand it more???
    Thanks,
    Franki

  10. #10
    Join Date
    Mar 2004
    Location
    belgium
    Posts
    290

    Cool

    well let me try to explain more, if you have a sql selection recordset of your database, and in your table you have a field with the path and filename of the pictures you can do it a bit easier.

    Sub ShowPics()

    Dim nI As Long
    Dim nFotTel As Long

    On Error Resume Next

    nFotTel = 0

    ' IF any bookmark is saved put here a flag in case of a next call
    ' recsetCars.Bookmark = vBookmark ' the saved bookmark
    ' ELSE

    recsetCars.movefirst ' top of recordsetCars

    ' ENDIF

    Do while recsetCars.eof = false

    nFotTel = nFotTel + 1 ' Counter for max number of image fields on the form

    Me("imgPic" & Trim(Str(nFotTel))).Picture = recsetCars![PictureLocation]
    Me("tbPicName" & Trim(Str(nFotTel))) = RecsetCars![Carname]
    Me("tbPicNr" & Trim(Str(nFotTel))) = RecsetCars![CarNumber]

    If nFotTel = 16 Then ' max imagefields my form has 16 pictures

    Me!cmdVolgende.Caption = "Next row" ' eventually change caption of the cmd

    ' vbookmark = recsetCars.bookmark 'the record pointer

    exit do

    End If

    recsetCars.movenext ' next picture

    loop

    if recsetCars.eof = true then
    recsetCars.movefirst
    endif

    For nI = nFotTel + 1 To 16 ' clear the not used imagefields on the form

    Me("imgPic" & Trim(Str(nI))).Picture = ""
    Me("tbPicName" & Trim(Str(nI))) = ""
    Me("tbPicNr" & Trim(Str(nI))) = ""

    Next nI

    Me!cmdVolgende.Caption = "Start" ' reset caption of the cmdbutton

    End Sub

    I my case i have 16 image-objects name imgPic1 -> imgPic16, there I use the nI to change the imgPic##, and 16 textbox objects for the name and the number.

    So play around, and never for get with try and error you learn more ..

  11. #11
    Join Date
    Nov 2004
    Posts
    64
    Hi Emeil,
    Great stuff, i'll have a play over the weekend.
    Thanks for you efforts, have a nice weekend.
    Franki

  12. #12
    Join Date
    Aug 2009
    Posts
    1
    you have a field with the path and filename of the pictures you can do it a bit easier.
    demande taux pret personnel en ligne credit simulation Faire un pret immobilier en ligne avec un bon creditdemande taux pret personnel en ligne credit simulation

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •