Results 1 to 3 of 3
  1. #1
    data808 is offline Noob
    Windows 10 Access 2013 32bit
    Join Date
    Aug 2012
    Posts
    727

    Attach PDF To Record For Viewing

    I was wondering if it was possible to store a PDF file on a network drive and assign/attach it to a record then be able to view it by clicking a hyper link label or possibly a button that will allow the user to view the attached PDF. For the PDF file path I was thinking of referencing some text boxes in the record itself like username, date, and finally reference number (primary key). The reference number could be the actual file name of the PDF so it knows which file to pull up for viewing.



    If this is possible, could someone work with me to build it from the ground up? I will definitely need help with the VBA.

    Thank you very much for your time.

  2. #2
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    To me, your post implies that you want the record to contain a file reference (that would be its file path). That means a table field that contains file path as part of the record. If there could be several files related to the record, you should have a table for attachment records. Best method IMO is to use a file dialog (e.g. msoFileDialogFilePicker) that you open from your form, choose the file from Windows File Explorer (that is basically what you end up opening) and store the path in the record. While you can store files in an attachment field in Access, you would be wise to not do so due to db bloat.
    reference number (primary key). The reference number could be the actual file name of the PDF
    No. PK fields should never be meaningful data. Might be a good idea for you to review for that pointAbout Auto Numbers
    - http://access.mvps.org/access/general/gen0025.htm

    If you search, you will find many pages on how to use the file dialogs.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,235
    If you have the 32 version of Office\Access you can have a look at the attached sample that allows you to view the contents of a selected folder and preview the files in a bound object frame. Double-clicking the file on the left will open it in its default application. So you should have most of the code you need to start building yours, post back if you get stuck. If you have the 64 bit version let me know and I'll try to make the sample work with that.

    Cheers,
    Attached Files Attached Files
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Replies: 1
    Last Post: 04-13-2017, 05:09 PM
  2. Returning to Record after Viewing Report
    By Robert2150 in forum Access
    Replies: 3
    Last Post: 02-09-2016, 07:04 PM
  3. Returning to record after viewing a report.
    By Robert2150 in forum Access
    Replies: 6
    Last Post: 09-01-2015, 08:31 AM
  4. Replies: 15
    Last Post: 04-06-2014, 10:29 AM
  5. Replies: 9
    Last Post: 01-20-2013, 10:27 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