Results 1 to 3 of 3
  1. #1
    Firemann25 is offline Novice
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    8

    adding word documents and pdf's to a form

    I am attempting to create a database where I can input a number that will display a word document, and pdf's, and be able to toggle through them. I have all the data compiled. I just need to present it in some type of a front.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,527
    I have a table tDocs
    docID
    name
    path

    The ACTUAL pdf, docs are on the network in a folder. In your continuous form put a search box, and a button to open the doc.
    Use the code below to open the doc, regardless of the data type.

    Paste this code into a module, and it will open ANY file in its native application.

    usage: OpenNativeApp "c:\folder\file.pdf" will open it in acrobat
    and
    OpenNativeApp "c:\folder\file.doc" will open the doc in Word, etc.
    for you it would be
    OpenNativeApp me.txtPath


    Code:
    'Attribute VB_Name = "modNativeApp"
    'Option Compare Database
    Option Explicit
    
    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpszOp As String, ByVal lpszFile As String, ByVal lpszParams As String, ByVal lpszDir As String, ByVal FsShowCmd As Long) As Long
    
    Private Declare Function GetDesktopWindow Lib "user32" () As Long
    Const SW_SHOWNORMAL = 1
    Const SE_ERR_FNF = 2&
    Const SE_ERR_PNF = 3&
    Const SE_ERR_ACCESSDENIED = 5&
    Const SE_ERR_OOM = 8&
    Const SE_ERR_DLLNOTFOUND = 32&
    Const SE_ERR_SHARE = 26&
    Const SE_ERR_ASSOCINCOMPLETE = 27&
    Const SE_ERR_DDETIMEOUT = 28&
    Const SE_ERR_DDEFAIL = 29&
    Const SE_ERR_DDEBUSY = 30&
    Const SE_ERR_NOASSOC = 31&
    Const ERROR_BAD_FORMAT = 11&
    
    
    Public Sub OpenNativeApp(ByVal psDocName As String)
    Dim r As Long, msg As String
    
    r = StartDoc(psDocName)
    If r <= 32 Then
        'There was an error
        Select Case r
            Case SE_ERR_FNF
                msg = "File not found"
            Case SE_ERR_PNF
                msg = "Path not found"
            Case SE_ERR_ACCESSDENIED
                msg = "Access denied"
            Case SE_ERR_OOM
                msg = "Out of memory"
            Case SE_ERR_DLLNOTFOUND
                msg = "DLL not found"
            Case SE_ERR_SHARE
                msg = "A sharing violation occurred"
            Case SE_ERR_ASSOCINCOMPLETE
                msg = "Incomplete or invalid file association"
            Case SE_ERR_DDETIMEOUT
                msg = "DDE Time out"
            Case SE_ERR_DDEFAIL
                msg = "DDE transaction failed"
            Case SE_ERR_DDEBUSY
                msg = "DDE busy"
            Case SE_ERR_NOASSOC
                msg = "No association for file extension"
            Case ERROR_BAD_FORMAT
                msg = "Invalid EXE file or error in EXE image"
            Case Else
                msg = "Unknown error"
        End Select
    '    MsgBox msg
    End If
    End Sub

  3. #3
    Firemann25 is offline Novice
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    8
    Thanks for the help, I have to find a way to store my file, approx. 600. I'd like to build a front page where the user types in a number, then the data is shown.

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

Similar Threads

  1. Replies: 1
    Last Post: 03-22-2014, 04:10 PM
  2. Replies: 0
    Last Post: 05-17-2012, 09:24 AM
  3. Access to Word Merge into Separately Saved Documents
    By alpinegroove in forum Programming
    Replies: 6
    Last Post: 01-05-2012, 04:49 PM
  4. Replies: 6
    Last Post: 07-26-2010, 01:53 PM
  5. Categorizing Word documents with Access
    By radagast in forum Access
    Replies: 0
    Last Post: 06-14-2009, 12:06 AM

Tags for this Thread

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