.FoundFiles.Count ".Filename" Error

J

john

I'm getting an error in access 97 using the * wildcard in the .FileName, I'm
showing the variations I've tried

Private Sub Command123_Click()
Dim fs As Object
Set fs = Application.FileSearch
With fs
.NewSearch
.Lookin = "C:\Records"
.MatchTextExactly = False

.FileName = "note.txt" 'Works to find files count
.FileName = "*.txt" 'Error: Invalid Procedure Call or Argument
.FileName = "*.*" 'Error: Invalid Procedure Call or Argument
.FileName = "note.*" 'Error: Invalid Procedure Call or Argument

If .Execute(SortOrder:=1) > 0 Then
msgbox "There were " & .FoundFiles.Count & _
" file(s) found."
Else
msgbox "There were no files found."
End If
End With
Set fs = Nothing
End Sub
 
J

john

Just an update I've found this to work, Any Comments as to why?

.FileName = """*"".*"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top