Results 1 to 3 of 3
  1. #1
    WAVP375 is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Dayton Ohio
    Posts
    171

    Putting images in the database


    I am attempting to include a document in my data base records. The documents will be either PDF or JPEG. Since this will be a low volume production implementation I need to place the document in the data entry form so when the record is saved the form is also saved. Manipulating the record in datasheet view is not acceptable for production application. I would consider an environment where the documents are in a separate folder with some sort of linkage from the table to the document folder.

    Can you send me in the right direction?
    Thanks in advance.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    I store all documents pdf/jpg on there server. Users can set the path. The path is stored on the record.
    To open the doc, they click a button that opens ANY document based on file extension using:

    Paste this code into a module, and it will open ANY file in its native application.
    usage: OpenNativeApp txtBox
    file.pdf, will open it in acrobat, file.jpg will open in imageviewer or whatever is assigned. You can set the files as readonly.

    Put the code below in a module:
    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
    WAVP375 is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Dayton Ohio
    Posts
    171
    Not being a VB heavy, I don't see the connection to the path in the record field.
    What would be the code behind the button

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

Similar Threads

  1. Design of a Database of Images
    By flshfrnd in forum Database Design
    Replies: 6
    Last Post: 09-26-2015, 06:07 AM
  2. Database With Tags for Images
    By bslarch in forum Access
    Replies: 3
    Last Post: 02-20-2015, 03:43 PM
  3. Removing images from the database
    By ksammie01 in forum Access
    Replies: 4
    Last Post: 01-15-2013, 12:50 AM
  4. Putting Picture in database
    By adifa in forum Queries
    Replies: 12
    Last Post: 07-03-2012, 06:34 PM
  5. Putting a Finished Database up on the Network
    By Imgsolutions in forum Access
    Replies: 1
    Last Post: 07-14-2010, 03:56 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