Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2003
    Posts
    2

    Unanswered: application.filesearch keep looking for old file

    When I first time execute application.filesearch it seeks correctly. but on latter searches it uses prebuilt index and keep looking in that path.even though I have moved file to inner directory. I have to leave the program for 15-20 mins then perhaps it clears it cache and works. I am not getting how to clear its cache. code is like this.pls help

    With Application.FileSearch
    .NewSearch
    .LookIn = PerformanceBook.Path
    .SearchSubFolders = True
    .Filename = "omsTimes.csv"
    .FileType = msoFileTypeAllFiles
    If (.Execute(SortBy:=msoSortByLastModified, SortOrder:=msoSortOrderAscending, AlwaysAccurate:=True) <> 0) Then

  2. #2
    Join Date
    Sep 2003
    Location
    Cincinnati, Oh USA
    Posts
    203

    Re: application.filesearch keep looking for old file

    Appears to me that your not defining you path statement. The "lookin"
    statement should be something like .LookIn = "C:\My Documents".

    Originally posted by kmr_ashutosh
    When I first time execute application.filesearch it seeks correctly. but on latter searches it uses prebuilt index and keep looking in that path.even though I have moved file to inner directory. I have to leave the program for 15-20 mins then perhaps it clears it cache and works. I am not getting how to clear its cache. code is like this.pls help

    With Application.FileSearch
    .NewSearch
    .LookIn = PerformanceBook.Path
    .SearchSubFolders = True
    .Filename = "omsTimes.csv"
    .FileType = msoFileTypeAllFiles
    If (.Execute(SortBy:=msoSortByLastModified, SortOrder:=msoSortOrderAscending, AlwaysAccurate:=True) <> 0) Then
    Rick Knight
    KnightShift Office Solutions and Horse Breaking
    VB, VBA, FileMaker, Access Solutions, Web Solutions

  3. #3
    Join Date
    Dec 2003
    Posts
    2

    application.fileserch

    I ahve used .lookin . But I am facing this problems

    when I move files to inner directory and then run my application.filesearch it still keeps tells location of files as previous one. If I restart the machine and leave it for half an hour then it tells correct location of files. It keeps the result cached and some how I have to clear it.

    With Application.FileSearch
    .NewSearch
    .FileType = msoFileTypeAllFiles
    .LookIn = PerformanceBook.Path
    .SearchSubFolders = True
    .Filename = "omsTimes.csv"
    If (.Execute(SortBy:=msoSortByLastModified, SortOrder:=msoSortOrderAscending) <> 0) Then

    fcount = .FoundFiles.count
    For count = 1 To .FoundFiles.count
    allcsvfiles(count) = .FoundFiles.Item(count)
    Next count
    End If
    End With

  4. #4
    Join Date
    Aug 2007
    Posts
    1

    Indexing Service (cache) was my problem

    Regarding your message left on dbforums.com about FileSearch keeping old files in some type of cache, I found that I had the same problem until I turned off indexing service with my "Search Companion" in Windows Explorer. Then the following lines worked.

    With Application.FileSearch
    .NewSearch
    .FileName = "*.txt"
    .LookIn = xPath
    .Execute
    xTotalFiles = .FoundFiles.Count
    End With

    For i = 1 To xTotalFiles
    .
    .
    .
    Next i

    Hope this helps.

  5. #5
    Join Date
    Jan 2010
    Posts
    1

    Thumbs up Brilliant

    Nice one, Turning off the indexing service solved my issues. Found this page with a quick google so many thanks Mike.

    Jim

Posting Permissions

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