Results 1 to 4 of 4
  1. #1
    hassan.tajdar is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2017
    Posts
    6

    Automatically add images to access database by looking up file names specified inside

    Hi Everyone,

    I have a database where in column 1 the "material numbers" are given for which I want to attach images in the database. All the images that I want to add are stored in one folder location on my pc from where I have to add them manually as attachments into the database. Since I am going to be doing this on a regular basis I was looking for some help in writing a VBA script for looking up file names from Column 1 and adding them as attachments. The image files are named according to the corresponding "material numbers".



    So if in column 1 i have an entry 123456, then the image file also has the name 123456.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Rather than add the image to the db, I have code to just display the image.
    1. it builds the path dynamically based on the ID 123456
    2. it keeps the db small by not filling it up with images that already exist outside the db

    any interest in this?

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    Attachment field is a type of multi-value field. VBA code opens parent and child recordsets. Review https://msdn.microsoft.com/en-us/lib...ffice.12).aspx

    But as ranman stated, embedded files, especially images, can really chew up 2GB Access file size limit. Suggest using ControlSource property of Image Control to dynamically load images from external folder location. An expression in ControlSource can be like: ="C:\foldername\" & [fieldname] & ".pdf"
    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.

  4. #4
    hassan.tajdar is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2017
    Posts
    6
    Quote Originally Posted by ranman256 View Post
    Rather than add the image to the db, I have code to just display the image.
    1. it builds the path dynamically based on the ID 123456
    2. it keeps the db small by not filling it up with images that already exist outside the db

    any interest in this?

    Yes please! If you can also tell me where to insert the code (as in create a new module for VB code?) it would be quite helpful!

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

Similar Threads

  1. Replies: 6
    Last Post: 02-13-2017, 09:55 AM
  2. Replies: 0
    Last Post: 02-29-2016, 05:27 PM
  3. Replies: 2
    Last Post: 11-06-2013, 10:43 AM
  4. Replies: 12
    Last Post: 06-27-2013, 07:29 AM
  5. Upload file inside .mdb database file
    By havish in forum Access
    Replies: 0
    Last Post: 07-30-2008, 07:35 AM

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