Results 1 to 8 of 8
  1. #1
    christ2000 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    45

    Question Is this Possible In Access? Uploads To Local Folder

    Hello Guys, is there any way to allow in my DB upload Documents(pdf, Excell Words Docs) to a local folder and not using the attachment field to avoid DB grow a lot.?



    Thankss

  2. #2
    Minty is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    You probably want them stored in a central network location, where any user can get to them.
    You can move files around using VBA, create and delete folders, and you can list files in folders to list boxes etc. to allow them to be opened.

    It really depends on your actual needs and business processes as to which method would work best.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    Found via Google search--I have adjusted and tried the code.
    NOTE: You need a reference to the scripting runtime

    Code:
    '---------------------------------------------------------------------------------------
    ' Procedure : TryIt
    ' Author    : mellon
    ' Date      : 19-Jan-2018
    ' Purpose   : Using msAccess FileSystemObject to move or copy Files from a folder to another
    '---------------------------------------------------------------------------------------
    '
    Sub TryIt()
        Dim FSO As Object
        Dim FromPath As String
        Dim ToPath As String
        Dim FileInFromFolder As Object
    
    10    On Error GoTo TryIt_Error
    
    
    20    FromPath = "C:\users\mellon\documents\"
    30    ToPath = "C:\users\mellon\downloads\"
    
    40    Set FSO = CreateObject("scripting.filesystemobject")
    
    
    50    For Each FileInFromFolder In FSO.GetFolder(FromPath).files
    
    60      If Right(FileInFromFolder.name, 3) = "png" Then
    70          'Debug.Print FileInFromFolder.name
    80          FileInFromFolder.Copy ToPath   'use .move to move the file
    90      End If
    100   Next FileInFromFolder
    
    TryIt_Exit:
    110   Exit Sub
    
    TryIt_Error:
    120   MsgBox "Error " & err.number & " in line " & Erl &  " (" & err.Description & ") in procedure TryIt of Module  AWF_Related"
    130   Resume TryIt_Exit
    End Sub

  4. #4
    christ2000 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    45
    Thanks For the solutions but do not do what I need, actually could better if when I click in a field this ask for file location and just paste in this field the path to the file, so later user can open the file clicking on the link

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    Sure, if you convert the sub to a function with appropriate parameters, it can be done.
    Often advisable to describe what you are trying to do in plain English --no jargon and no database --
    and give an example showing before and after(expected result).

    Please describe your need with an example, and I'll convert to a function.

  6. #6
    christ2000 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    45
    Quote Originally Posted by orange View Post
    Sure, if you convert the sub to a function with appropriate parameters, it can be done.
    Often advisable to describe what you are trying to do in plain English --no jargon and no database --
    and give an example showing before and after(expected result).

    Please describe your need with an example, and I'll convert to a function.
    First sorry for my English, I am Spanish speaker.

    that I need is simple 1 field that hold the path to a folder or file, each user will save documents in different folders , so when I click in this field access must ask for FOLDER OR FILE PATH, and a option to be able to open this files

    thanks

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    christ2000,
    Since English is not your native language, I suggest you use google translate. Write a clear detailed description of what you need in Spanish, then translate that to English. Google translate is very adequate to communicate on this forum.


    You want file or all files in a folder?
    If you only want to open a file from a folder, you should look at the FileDialog object.
    My original understanding of your need was to move fileA from folderX to folderY via Access.
    Now, I am not clear on exactly what you want to achieve.
    Perhaps you should create an example showing before and after situation.

    Google translate's version

    Como el inglés no es su lengua materna, le sugiero que use google translate. Escriba una descripción clara y detallada de lo que necesita en español, luego traduzca eso al inglés. Google translate es muy adecuado para comunicarse en este foro.

    ¿Quieres un archivo o todos los archivos en una carpeta?
    Si solo desea abrir un archivo desde una carpeta, debe mirar el objeto FileDialog.
    Mi comprensión original de su necesidad fue mover el archivo A de la carpeta X a la carpeta Y a través de Access.
    Ahora, no tengo claro qué es exactamente lo que quieres lograr.
    Tal vez deberías crear un ejemplo que muestre la situación antes y después.



  8. #8
    christ2000 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    45
    Ok, my first idea was to upload and save it to a folder and not access, but now I just need that when the user click on a field is ask for the path to the file and this path is saved in this field,

    now I have this code, but I don't know how storage the path on the field:
    Code:
    Private Sub lblFolder_Click()
        Dim f As Object
        Dim strFile As String
        Dim strFolder As String
        Dim varItem As Variant
        Set f = Application.FileDialog(3)
        f.AllowMultiSelect = True
        If f.Show Then
               For Each varItem In f.SelectedItems
                         strFile = Dir(varItem)
                         strFolder = Left(varItem, Len(varItem) - Len(strFile))
                         MsgBox "Folder: " & strFolder & vbCrLf & _
                                           "File: " & strFile
               Next
        End If
        Set f = Nothing
    End Sub
    Last edited by orange; 01-19-2018 at 11:39 AM. Reason: added code tags and indent

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

Similar Threads

  1. Replies: 10
    Last Post: 09-09-2015, 03:25 AM
  2. Replies: 23
    Last Post: 07-09-2014, 02:16 PM
  3. Replies: 12
    Last Post: 06-03-2014, 08:04 AM
  4. Register Access on my local machine
    By Philosophaie in forum Access
    Replies: 1
    Last Post: 05-07-2014, 06:42 PM
  5. Replies: 0
    Last Post: 05-14-2010, 08:43 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