Results 1 to 13 of 13
  1. #1
    Hossein's Avatar
    Hossein is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Oct 2018
    Posts
    24

    Open hyperlink and print documents

    My dear friends

    I have some hyperlink in my database as below picture:

    Click image for larger version. 

Name:	Link1.PNG 
Views:	26 
Size:	77.1 KB 
ID:	36249



    I create a report which prints some information on A4 paper. for example this information belongs to PO Number 90101205 [you can find this PO number in picture]

    Finlay I need to a VBA code that opens hyperlink and prints attached documents to related PO number 90101205 as well

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Maybe. Review https://social.msdn.microsoft.com/Fo...-external-file

    I have not gotten anything to work yet.

    If these are PNG image files, why don't you just make them part of report with an Image control? Reference the image file path in ControlSource property. If the file path is not already in a text field, it can be extracted from the hyperlink 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
    Hossein's Avatar
    Hossein is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Oct 2018
    Posts
    24
    Quote Originally Posted by June7 View Post
    Maybe. Review https://social.msdn.microsoft.com/Fo...-external-file

    I have not gotten anything to work yet.

    If these are PNG image files, why don't you just make them part of report with an Image control? Reference the image file path in ControlSource property. If the file path is not already in a text field, it can be extracted from the hyperlink string.
    I want open hyperlink by using click on a bottom. i try do to but not successful

    you can find the my code, forms and errors as the below pictures :


    Click image for larger version. 

Name:	1.jpg 
Views:	18 
Size:	208.3 KB 
ID:	36272
    Attached Thumbnails Attached Thumbnails 2.jpg   3.jpg   4.jpg  

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Code works for me. Cannot replicate issue.

    Again, why not use an Image control in report and make the image part of the report?
    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
    Hossein's Avatar
    Hossein is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Oct 2018
    Posts
    24
    Quote Originally Posted by June7 View Post
    Code works for me. Cannot replicate issue.

    Again, why not use an Image control in report and make the image part of the report?
    If i want open link by Firefox it's working, but i want open images or documents by windows programs and i cannot do that.

    why not use an Image control in report and make the image part of the report?
    Because some times the link includes PDF files. can image control open PDF files ?

    Also i try to do that but i have same error

    Click image for larger version. 

Name:	error1.jpg 
Views:	17 
Size:	138.3 KB 
ID:	36277

  6. #6
    Hossein's Avatar
    Hossein is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Oct 2018
    Posts
    24
    I found a new simple way for open the hyperlink by using bottom, but i have same error !

    Attachment 36278

    Attachment 36279

  7. #7
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Responding to a PM by Hossein...
    Not sure exactly what this thread is about but I'm unable to open either attachment from the last post

    I NEVER use Hyperlink fields as they are often problematic.
    Suggest you change it to a text field and just enter the file path

    Then if you want to open that path use: Application.FollowHyperlink "yourfilepath"
    Or to view the picture use : Me.PI_Image.Picture = "yourfilepath"
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  8. #8
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,421
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  9. #9
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,879
    You should probably test if the file exists before trying to open it.

    just a guess but in your screenshot there is an octothorpe (#) after the file name which leads me to believe your using a hyperlink datatype and your passing some of the display text.

    heres some info on hyperlink datatype... https://codekabinett.com/rdumps.php?...link-data-type

  10. #10
    Hossein's Avatar
    Hossein is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Oct 2018
    Posts
    24
    Quote Originally Posted by Micron View Post
    I use it but i couldn't fix my error

  11. #11
    Hossein's Avatar
    Hossein is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Oct 2018
    Posts
    24

    Thumbs up

    Quote Originally Posted by moke123 View Post
    You should probably test if the file exists before trying to open it.

    just a guess but in your screenshot there is an octothorpe (#) after the file name which leads me to believe your using a hyperlink datatype and your passing some of the display text.

    heres some info on hyperlink datatype... https://codekabinett.com/rdumps.php?...link-data-type
    Many Many Many thanks for your help. Really do not know how to thank you.

    My problem fixed by part GetHyperlinkFullAddress.

  12. #12
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,879
    Glad you got it sorted out.

    I'm not a fan of hyperlink datatype and find it difficult to work with.

    My preference is to store the link or file path as plain text and use shell execute to open it.
    heres a link to a Shell execute procedure...http://access.mvps.org/access/api/api0018.htm

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    And no, an Image control cannot display PDF file. Guess you will have to stick with solution of printing separately.
    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.

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

Similar Threads

  1. Print all PDF Documents in a folder
    By sdel_nevo in forum Programming
    Replies: 7
    Last Post: 03-01-2017, 09:49 AM
  2. How to print off multiple word documents
    By Ajz1971 in forum Access
    Replies: 10
    Last Post: 01-20-2017, 07:57 AM
  3. Replies: 2
    Last Post: 07-01-2014, 07:24 AM
  4. Replies: 1
    Last Post: 03-22-2014, 04:10 PM
  5. Replies: 5
    Last Post: 10-28-2013, 08:09 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