Results 1 to 10 of 10
  1. #1
    JFo is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    393

    Working with pictures

    It has been a long time since I have been back to my database and have decided to try and ascertain the best way to do my major problem that was holding me back, storing images.

    Basically for every piece of equipment there can be many inspections and for every inspection there can be many pieces of equipment --> For every piece of equipment and every inspection there can be many images of the equipment

    Obviously the major limitation is the 2GB database size limit for access, however unfortunately I like the attachment field.

    For every piece of equipment I would like to have all the images joined to the equipment and also to the corresponding inspection as well so I have put this field into the junction table.

    What I would also like to do is be able to add multiple images at a time (this is done easily with attachment)

    Also I would like to be able to view images from past inspections for a particular piece of equipment (on forms preferably live)

    Additionally I would like all the images linked to a certain piece of equipment and inspection to be printed automatically on a report



    This obviously needs to use links as per the database size however the best way that I can see is with the attachment field. Is there any way to change the attachment field to link to attachment rather than storing it directly into database?

    Thanks

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    49,612
    No, that is what attachment field is for, to store object within table, not link to external object. You need to use child table to save the collection of path strings for the image. Each record would have EquipmentId as fk and the image path string.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    JFo is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    393
    Thanks June 7

    Images will need to be joined to EquipInspectID junction table key to select what equipment is inspected in what inspection

    What child table? Do you suggest I create another table that records image path and EquipInspectID as fk? What sort of field would I use for this if not attachment

    Can I still display these images on a form, will this automatically print the images in reports from the link (path string), can I add multiple (say 20) images in one step (not one at a time)?

    Thanks again

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    49,612
    Yes, am suggesting another table. Image path would be stored in a text field. Use an image control to display images. Image control has a ControlSource property which would be bound to the path field. Would have to input each string manually one at a time. Or write some fancy VBA code to save multiple selections from Windows file dialog.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    JFo is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    393
    OK so I create a new tblImages with 3 fields ImageID, EquipInspectID and Link (text field) and do I need to create another field for every possible Image you add, Link1, Link2, Link3... Link20 etc?

    Bit disappointed I would have to enter 1 at a time (is there no way around this) and at very least I would need it automatically insert this link/ address by using a browse/ preview system similar to attachment (is this possible)?

    Thanks

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    49,612
    No, would be a record for each image, not a field.

    So EquipInspectID 27 might have 7 image records and EquipInspectID 49 might have 20 image records. This is 1 to many relationship.

    Yes, the browse could be done. It is tricky because have to use Windows file browser. Check out http://msdn.microsoft.com/en-us/libr...ffice.11).aspx
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    JFo is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    393
    Thanks June7 I have created the tables and am trying to create the browser, will let you know

    Cheers

  8. #8
    JFo is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    393
    Hi June7

    I could not get it to work with the reference library but it seems to be working with the following code

    Private Sub cmdAddImages_Click()

    Dim f As Object
    Dim ImagePath As Variant


    Set f = Application.FileDialog(3)
    f.AllowMultiSelect = True
    f.Show

    MsgBox "file choosen = " & f.SelectedItems.Count

    For Each ImagePath In f.SelectedItems

    MsgBox "this is Image Path = " & ImagePath

    txtImagePath = ImagePath
    DoCmd.Save
    DoCmd.GoToRecord acActiveDataObject, , acNext

    Next ImagePath

    End Sub

    Can you see anything wrong with doing it this way, it seems to add multiple files at a time and insert the path into the correct table?

    Now I just need to work out how to display/ Preview these pictures on the form and print them out with reports/ queries etc

    Thanks

  9. #9
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    49,612
    Looks good and it works - congratulations!

    Once you are confident about the code, might remove the message box popup.

    Now just use the Image Control on forms and reports with ControlSource set to that field.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #10
    JFo is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    393
    Thanks June7, I think I have figured it all out now

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Pictures not printing
    By Curtis1000 in forum Reports
    Replies: 7
    Last Post: 09-28-2011, 08:23 PM
  2. Pictures in Access Field
    By cotri in forum Access
    Replies: 2
    Last Post: 09-13-2010, 09:05 AM
  3. Linking pictures
    By cowboy in forum Access
    Replies: 4
    Last Post: 02-15-2010, 05:39 PM
  4. Pictures sizing
    By newtoAccess in forum Access
    Replies: 0
    Last Post: 11-22-2009, 10:10 AM
  5. Adding filenames to pictures
    By Plumber in forum Forms
    Replies: 1
    Last Post: 02-11-2009, 10:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums - Senior Forums