Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

application.filesearch vista problem

Status
Not open for further replies.

cubby

MIS
Sep 19, 2002
6
US
I have code using application.filesearch that has worked great until installing on vista computer. The code does not get an error but always get an = "false" result.
Any ideas?
 
This code has worked for a long time and continues to work on the XP computers. With Vista it returns "Found = false"
when it should be = true.

With Application.FileSearch
.NewSearch
.LookIn = PicPath
.FileName = [SOCIAL_SEC] & ".jpg"
.Execute
Found = .FoundFiles.Count

If Found Then
[emppic].Picture = PicPath & [SOCIAL_SEC] & ".jpg" 'found picture
Else
[emppic].Picture = PicPath & "SAC.bmp" 'default
End If
End With
 
Hmmm. What would happen if you forced a type conversion? Maybe forcing the number to a long integer. Something like this?
Code:
With Application.FileSearch
        .NewSearch
        .LookIn = PicPath
        .FileName = [SOCIAL_SEC] & ".jpg"
        .Execute
        Found = clng(.FoundFiles.Count)
    
        If Found Then
            [emppic].Picture = PicPath & [SOCIAL_SEC] & ".jpg" 'found picture
        Else
            [emppic].Picture = PicPath & "SAC.bmp"  'default
        End If
    End With
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top