ACC97: No Match Results in FileSearch When Adding FileType

Last reviewed: November 24, 1997
Article ID: Q177091
The information in this article applies to:
  • Microsoft Access 97

SYMPTOMS

Advanced: Requires expert coding, interoperability, and multiuser skills.

When you search for file extensions using the FileType property of the FileSearch object, certain file extensions may return a "files found = 0" message even though the information does exist.

For example, this behavior occurs if you search for information on any of the following file extensions:

  • SYS
  • DLL
  • VXD
  • 386
  • DRV

CAUSE

When you search for files that are hidden by default by Windows, they are excluded from indexing and content searching if the FileType property is included.

RESOLUTION

Do not include the FileType property if the file extension is not normally found in the Files Of Type box in the File Open dialog box.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a module and type the following line in the Declarations section if it is not already there:

          Option Explicit
    

  2. Type the following procedure:

          Sub TestSearch()
             Dim objFS As Object
    
             Set objFS = Application.FileSearch
    
             With objFS
    
                '  Resets all the search criteria settings to their default
                '  settings.
                .NewSearch
    
                '  Where to search in Windows 95. For Windows NT 4.0, change
                '  the path to "C:\Winnt\System32\".
                .LookIn = "C:\"
    
                '  This will limit the search.
                .FileType = msoFileTypeAllFiles
    
                .FileName = "*.SYS"
    
                '  Search for "WinDir" within a file. This string is present
                '  in the file, MSDOS.SYS, in Windows 95. For Windows NT 4.0,
                '  change to "Invalid."
                .TextOrProperty = "WinDir"
    
                '  Limit the search to the root.
                .SearchSubFolders = False
    
                '  Begin the search.
                .Execute
            End With
    
             ' Show the number of files found.
             MsgBox "Files found = " & objFS.FoundFiles.Count
    
          End Sub
    
    

  3. To test this function, type the following line in the Debug window, and then press ENTER:

          TestSearch
    

    Note that the message box opens and displays the following message:

          Files found = 0
    

  4. Comment out the following line of code by placing an apostrophe (') in front of the line:

          .FileType = msoFileTypeAllFiles
    

  5. Rerun the procedure.

    Note that the message box displays the correct count for the files that contain the search string.

REFERENCES

For more information about "FileSearch," search the Help Index for "FileSearch object," or ask the Microsoft Access 97 Office Assistant.


Additional query words: 97
Keywords : GnlFnd
Version : WINDOWS:97
Platform : WINDOWS
Hardware : x86
Issue type : kbprb
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 24, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.