Results 1 to 10 of 10
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Directory problem (MSACCESS2003)

    Where is Subdr defined? Within the procedure or at the module level?

  2. #2
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Directory problem (MSACCESS2003)

    I have code which files all directories under a main directory, however when I try to file names of subdirectories within subdirectories I have a problem. When I look at the part "ParseFolder5 MainDir & "" & Subdr" I discover that Subdr is a document name. Where am I going wrong? Thanks

    ' ==================== GET LIST OF SUBDIRECTURIES WITHIN MAIN DIRECTORY ========================

    SQL3 = "Select * From tblSubdir"
    Set rst3 = db.OpenRecordset(SQL3, dbOpenDynaset)

    For Each sfl In fld.SubFolders

    rst3.FindFirst "SubdirectoryName = " & Chr(34) & sfl.Name & Chr(34)

    If rst3.NoMatch = False Then ' Record found
    PK2 = rst3("subID") ' Get directory and primary key
    JPP = sfl.Name
    End If

    Subdr = sfl.Name ' I AM GETTING WHAT i THOUGHT WAS A SUBDIRECTORY NAME HERE

    If rst3.NoMatch Then
    ' Dump data to table
    rst3.AddNew
    rst3![SubDirectoryName] = sfl.Name
    JPPP = rst3("SubDirectoryName")
    JPP = sfl.Name
    JP = MainDir & ""
    rst3("DirID") = PK
    PK2 = rst3("subID")
    rst3.Update

    Else
    ' File already in table

    End If

    ' ==================== GET LIST OF SUBDIRECTURIES WITHIN MAIN DIRECTORY ENDS ==================


    ' Now extract documents within directory of sfl.Name
    ParseFolder4 MainDir & "" & sfl.Name

    ' Now extract any sub/sub directory names
    ParseFolder5 MainDir & "" & Subdr

    Next sfl

  3. #3
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Directory problem (MSACCESS2003)

    Hi Hans. I have just edited my last post showing where I thought the subdirectory name was - and put into SubDr (a variable declared in the form) Hope that helps, thanks

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Directory problem (MSACCESS2003)

    Sorry, what I meant was: where is the variable Subdr declared?

    Dim Subdr As String

    Is that within the procedure or somewhere at the top of the module?

  5. #5
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Directory problem (MSACCESS2003)

    Hi Hans, sorry I could not get back to you last night, the internet went too slow so I packed it in. The variable Subdr was declared in the forms declarations. Looking further Subdr was holding the 1st subdirectory name, however it still does not find a subdirectory of a subdirectory name. I have remmed out parts of the table saving in attempt to try and resolve the problem. Please excuse the rough long coding which is just to get it working. The form that is relevant is the docfinder, please open and then click on the re=populate button. Appreciate any help on identifying the problem with sub/sub directory names and there documents. Regards
    Attached Files Attached Files

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Directory problem (MSACCESS2003)

    You have commented out the code that adds files and folders at the lower levels.

    Several weeks ago, I provided some elegant and relatively simple code for this project or a precursor of it. Why have you made it so immensely complicated? It's very difficult to keep track of what's going on.

  7. #7
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Directory problem (MSACCESS2003)

    Thanks Hans. I tried using your code which worked well, however I could not break up the data to present the form layout as attached. The code will be broken down later, but for some reasons it all works until trying to get the subdirectory of a subdirectory names, and then the documents residing in those sub/sub folders. Stepping through, it seems to find a sub/sub directory and adds it to rst5 recordset, but when I look in the table there is nothing there? Regards

  8. #8
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Directory problem (MSACCESS2003)

    I have found the culprit of why my sub/sub directories are not working.

    Sub ListFilesAndSubFolders5(fld As Object)

    ' Dim fil As Object
    ' Dim sfl As Object

    I have remmed out the two lines above and now get my data. Regards

  9. #9
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Directory problem (MSACCESS2003)

    Hans, I have gone to your code and am going to use it. Sat with a cup of coffee and realised how I can recursively reset the parsing path to get what I want. Should have stuck with it earlier, as compared to the telephone directory I was writing is very tidy. Appologies and many thanks again. Regards

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Directory problem (MSACCESS2003)

    Good luck with it!

Posting Permissions

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