Results 1 to 6 of 6
  1. #1
    bbrazeau is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    101

    Open pdf document read only

    Is there a way to set a pdf document to read only when opening it? I have the following code that opens a pdf, but I also want to prevent the user from changing it in any way. No deletions, additions, substitutions or edits of any kind. I'd rather not use Hyperlink or Atachment data types either.

    Code:
     
    Private Sub OpenPrint_Click()
    Dim PDFPartPrint As String
    Dim AdobeProgramPath As String
    Dim RetVal As Integer
    AdobeProgramPath = "C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe " 'Hard coded program executable path!
    PDFPartPrint = (AdobeProgramPath & Forms![frmCustomers]![Child4].Form![Part Drawing Path]) ' Combined Program executable path and part drawing path!
    'MsgBox (PDFPartPrint)
    RetVal = Shell(PDFPartPrint, vbNormalFocus)
    End Sub


  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Code:
    setattr("path", 1)

  3. #3
    bbrazeau is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    101

    Open pdf document read only

    Thank you "ajetrumpet" for the reply. I tried implementing your suggestion several ways with no luck. Below is what I have. Could you be alittle more specific as to where the line of code should go, and what "path" should refer to?
    Code:
     
    Private Sub OpenPrint_Click()
    Dim PDFPartPrint As String
    Dim AdobeProgramPath As String
    Dim RetVal As Integer
    AdobeProgramPath = "C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe " 'Hard coded program executable path!
    PDFPartPrint = (Forms![frmCustomers]![Child4].Form![Part Drawing Path]) 'Set part drawing path!
    'SetAttr "AdobeProgramPath", 1
    PDFPartPrint = (AdobeProgramPath & PDFPartPrint) ' Combined Program executable path and part drawing path!
    'MsgBox (PDFPartPrint)
    RetVal = Shell(PDFPartPrint, vbNormalFocus)
    End Sub

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,743
    I haven't tried this, but based on "ajetrumpet"'s reply and this
    http://www.dbforums.com/microsoft-ac...read-only.html,
    I would try
    SetAttr PDFPartPrint , vbReadOnly
    ' you want the drawing path to be readonly
    - not the program path

    It's worth a try.

  5. #5
    bbrazeau is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    101

    Open pdf document read only(solved)

    Thank you orange. Still allows a user to use the "Save as" command, but at least it keeps them from inadvertently altering the parent file. I've tried to hide the location of the file from the user by using the "Shell" command and hiding the "Textbox" that supplies the file location. It's amazing, the ways a DB user can accidentally screw up a DB. I guess the only fool proof way of locking down the referenced drawing would be to set server rights for the directories they reside in to read only.

  6. #6
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,743
    I think you could try

    SetAttr PDFPartPrint , vbHidden + vbReadOnly

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

Similar Threads

  1. Replies: 2
    Last Post: 09-01-2011, 10:48 PM
  2. Open a word document from access
    By natalia in forum Programming
    Replies: 1
    Last Post: 10-13-2010, 08:04 AM
  3. wor document disappears
    By hornet385 in forum Access
    Replies: 1
    Last Post: 07-14-2010, 01:30 PM
  4. Document Database
    By Wrangler in forum Access
    Replies: 2
    Last Post: 01-22-2010, 11:16 AM
  5. Replies: 2
    Last Post: 10-19-2006, 04:37 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