[AccessD] more on FileSearch -- looking at PropertyTests

Susan Harkins harkins at iglou.com
Sun Apr 27 21:25:02 CDT 2003


I'm not how to discern when a search criteria needs to be added to the
PropertyTests collection. Several of the properties seem to work together
without any problem. There must be some rule or something to follow or than
just trying to run it as a property without adding it and having it fail. I
assumed the PropertyTests options were the same as the Property values in
the Advanced Search Task Pane. But when I enumerate through the
PropertyTests items in a basic search, I get File Name and File of Types --
both.

If I set both the File Name and the File of Types via the PropertyTests Add
method, I get nothing -- here's what I started wit, which works fine.

Private Sub cmdSpecifiedFolder_Click()
  Dim strList As String
  With Application.FileSearch
    .NewSearch
    .LookIn = CurDir()
    .SearchSubFolders = True
    .FileType = msoFileTypeDatabases
    If .Execute(msoSortByFileName) > 0 Then
      For Each var In .FoundFiles
        strList = strList & ";" & var
      Next
    End If
  End With
  Me!lstFiles.RowSourceType = "Value List"
  Me!lstFiles.RowSource = strList
End Sub

when I run through the PropertyTests collection, Files of Types is the only
one listed -- which surprises me because Files of Types is not in the
Property list in the Advanced tab (manual Search Task Pane) -- and the
documentation suggests that PropertyTests items correspond to these items.

Onward....adding the .FileName property doesn't work -- I get a list of the
appropriate file names, but it ignores the msoFileTypeDatabases constant and
returns any file type of the specified name. So, I tried adding .FileName
through

.PropertyTests.Add Name:="File Name", _
    Condition:=msoConditionEquals, _
    Value:=Me!txtFileName

returns an error.

.PropertyTests.Add Name:="Property or Text", _
    Condition:=msoConditionEquals, _
    Value:=Me!txtFileName

returns nothing.  I tried adding two items via .PropertyTests -- "File Name"
and "Files of Types" -- tried "Property Or Text" and "Files of Types: -- I
really can't figure this one out -- anyone have any clue where I'm going
wrong? Maybe it'll all make sense in the morning.

Susan H.



More information about the AccessD mailing list