Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    zkrucz is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2016
    Posts
    103

    Has anyone worked with hypelinks vs actual images as Attachments in Access dB to create PDFs?


    We currently import and save images in our DB which are then used to create PDF reports (with images) for our cutsomers.

    The problem that we encountered is the DB size of 2 GB.

    So, to circumvent the size problem, we are looking into using hyperlinks in place of images in the Attachment fields.

    However, before we embark in that direction, does anyone have experience with creating actual PDFs within access using hyperlinks in the Attachment field? Can this actually be done?

    As I noted above, with images loaded directly into the DB, I can create PDFs without any issues. So, my concern is that the hyperlink may not be recognized as an image in the creation of the PDF document. If so, how can that be resolved?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Hyperlinks are not objects, just strings. Hyperlinks would not be in Attachment field.

    Store path to external image file as text. Bind Image control ControlSource property to field to dynamically load images.
    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
    Gicu's Avatar
    Gicu is offline VIP
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    That is the only way I would do it (because of the 2 GB limit and general "bloating" of the back-end). And I wouldn't use hyperlinks, and attachment data type. All you need is a regular short text field in which you store the full path (path+ file name) to the image and on the report you add one or more image controls and set their properties in VBA.
    See these for some examples:
    https://support.microsoft.com/en-ca/...r-a-data-acces
    https://www.cimaware.com/expert-zone...crosoft-access

    Cheers,
    Vlad

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    @Gicu, what properties would you set in VBA?

    Code setting Picture property was required pre-Access2007. I have never done this.

    Use ControlSource property to dynamically load images - no VBA needed.
    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
    Gicu's Avatar
    Gicu is offline VIP
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    I assume the OP needs to dynamically change the picture for each of the customers, and some might not have a picture to load (talking from my own experience) so I would manipulate the visible and picture properties of the image control programmatically. For example I was creating a report showing a list of students with some info for each including their photo, so in the Detail_Format event of the report I would set the picture property to the right one for the current record and/or visible=true or false depending if the picture was there or not.
    Cheers,
    Vlad

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Alternatives:

    1. an image of text that says "No Image Available", save this image path in field or use IIf() expression in ControlSource

    2. a label control positioned behind the image control, image control BackStyle set to transparent
    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
    Gicu's Avatar
    Gicu is offline VIP
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    All good suggestions but I had no field to store the path in and no need for one as I was using a naming convention for storing pictures using the StudentID.jpg which was saving both db space and data entry as no one had to populate the field. But each one has different needs, the OP has not really specifies hers or his so can't really comment further.

    Vlad

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Even if there is no field for storing full path, can be done without VBA. An expression in ControlSource like:

    =CurrentProject.Path & "\StudentImages\" & [StudentID] & ".jpg"

    How the path is defined is very flexible. A literal string can be used instead of CurrentProject.Path. Can even use UNC reference in the string.

    So hopefully OP now has enough info to accomplish requirement.
    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.

  9. #9
    zkrucz is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2016
    Posts
    103
    thank you for pointing me in the right direction.

  10. #10
    zkrucz is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2016
    Posts
    103
    So, I reviewed the links and I see the 3rd way as the recommended solution. However, I am still not sure if the it is applicable to creating (exporting) PDFs within Access? In other words,the images must be unique to each record. Please confirm.

  11. #11
    Gicu's Avatar
    Gicu is offline VIP
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Not sure what you refer to as the 3rd way, but I can assure you that storing the path to the picture in a textbox (or building the path dynamically if you are using a consistent naming convention for your images) does work to create PDFs. All you need to do is to use DoCmd.OutputTo method to export your report to PDF.

    Cheers,
    Vlad

  12. #12
    zkrucz is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2016
    Posts
    103
    Great! Again, thank you again for your help.

  13. #13
    zkrucz is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2016
    Posts
    103
    Oh, one other question. I currently use the attachment field in queries to review/QC entries by comparing the image to the value entered by Techs. Will this feature be still available to me when the text replaces the actual image in the attachment field? Or, will this require additional programming to open the image when clicking on the attachment field?

  14. #14
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    What exactly are you doing now? Are you still using an Attachment field to embed images in table? Thought you wanted to avoid that.

    If you are storing path string in a text field, yes will need code to open the image in another application. This is not an Attachment field. It is just a normal text type field.

    I don't understand what you are comparing. The value entered into text field is the image path\name. What else would techs be entering?
    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.

  15. #15
    zkrucz is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2016
    Posts
    103
    Ok, until now, we have been storing images in Attachment fields to create PDFs for our customers AND using the same images (via queries) to review data entered by field Techs based on those images, prior to creating those PDFs. In this case, for example, the value of water meter reading (entered by the Tech) with a pic of the face of the water meter which showed the meter reading (later keyed in by the Tech as part of the field data).

    So, the image in the Attachment field serves double duty: review of data vs image, and the creation of PDFs once the QC process is completed.

    So, if we move away from using Attachments, how can I bring those images stored in the separate table, in a query? Or, would this no longer be feasible? And if so, what can be done to re-create this data/image review functionality having those images available in the distinct table?

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 03-13-2018, 12:16 PM
  2. Replies: 1
    Last Post: 07-09-2017, 11:14 PM
  3. Replies: 1
    Last Post: 06-19-2013, 07:41 AM
  4. Replies: 1
    Last Post: 12-17-2012, 08:29 PM
  5. Create PDFs from a report
    By twosides in forum Programming
    Replies: 42
    Last Post: 03-04-2010, 06:48 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