Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Brisbane, Australia

    Arrow Unanswered: Impossibility? importing file & path details.

    Hi people,

    It has been bugging me the last few days, is there any way of easily importing directory and file names etc, into an access database?

    I have a few "directory printing" tools but they don't offer what I need for the amount of information required to be indexed and consequently formatted and imported.

    My intention in the end is to be able to search the database for particular file names from our firm intranet and execute them as a hyper link.

    If there is an easier way of doing this then please do not hold back, Im only a humble accountant

    Any help would be greatly appreciated.


  2. #2
    Join Date
    Mar 2004
    Nashville, TN


    I dont know of any way to do it automated. It looks to me like there will be alot of data entry. Maybe putting all needed files on a 'server' computer would help. That way they are all in the same place, and then it would be a matter of organizing and inputing into the database.

    I am sorry I couldnt be of more help. There may be another solution, but at this time I do not know it. Someone else may post with something.

    Have you ever thought about thinking on purpose?

    Jarvis Stubblefield
    Patriot Designs
    Web/Database Development and Consulting by Patriot Designs

  3. #3
    Join Date
    Feb 2004
    The following code will get all file and folder names from drive C: and store the names in an array.

    Paste the following sample code text into a new code module and save it as GetDir Module:

    Private Declare Function OpenProcess Lib "kernel32" _
    (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, _
    ByVal dwProcessId As Long) As Long
    Private Declare Function GetExitCodeProcess Lib "kernel32" _
    (ByVal hProcess As Long, lpExitCode As Long) As Long
    Public Function GetDir(vArray As Variant)
    Dim hWnd As Long
    Dim hProc As Long
    Dim hExit As Long
    Dim hCode As Long
    hWnd = Shell(Environ$("COMSPEC") & " /C dir /b C:\ > C:\tempdir.txt", vbMinimizedFocus)
    hProc = OpenProcess(&H400, False, hWnd)
        hCode = GetExitCodeProcess(hProc, hExit)
    Loop Until hExit = 0
    Open "C:\tempdir.txt" For Input As #1
    ReDim vTemp(0) As String
    While Not EOF(1)
        ReDim Preserve vTemp(UBound(vTemp) + 1)
        Line Input #1, vTemp(UBound(vTemp))
    Close #1
    vArray = vTemp
    Kill "C:\tempdir.txt"
    End Function
    Function GetTest()
    Dim DirArray As Variant, CT As Integer
    Call GetDir(DirArray)
    For CT = 0 To UBound(DirArray)
        Debug.Print DirArray(CT)
    Next CT
    End Function
    In the Debug Window, type: GetTest

    ...and press Enter. The function should print out the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts