INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

.Execute Not Working

.Execute Not Working

(OP)
Hello-

I wrote some FileSearch code the gist of which is as follows:

Dim fs as object
set fs = application.filesearch

with fs
   .lookin = blah
   .filename = blah blah
   If .execute() > 0 then...

There are files in the searched file path and it works on my machine, but when running from another user's machine it does not work...i.e. .execute = 0.  Is there some setting that needs to be changed?

(The user does have access to the searched drive, file path etc.)


Thank you!

RE: .Execute Not Working

Hi

Please paste the full code.

stefen

RE: .Execute Not Working

(OP)
The relevant code is below.  Last night I logged in as myself on the users computer and everything worked fine.  This morning I gave full permissions to the related drive to the user (just to eliminate the permissions variable) and it still doesn't work.  The .execute command still returns 0 for some reason...(only for this user!)

strFileName = "11_111_*.*"
strMoveFolder = strRawFileDir & "Imported" & "\"

Dim fs As Object
Dim fs1 As Object
Dim fs2 As Object
Dim i As Integer

Set fs = Application.FileSearch
Set fs1 = CreateObject("scripting.filesystemobject")
Set fs2 = fs1.getfolder(strRawFileDir)

With fs
    .lookin = strRawFileDir
    .filename = strFileName
    If .Execute() > 0 Then
     

RE: .Execute Not Working

<Set fs = Application.FileSearch

What application is this?

RE: .Execute Not Working

(OP)
MS Access 2003.  Was that your question?

RE: .Execute Not Working

Does it work for this user if this line is changed to a standard folder on the user's PC?

strMoveFolder = strRawFileDir & "Imported" & "\"

RE: .Execute Not Working

(OP)
Hi-

I came to the conclusion there was some setting unique to the user that prevented the "FileSearch" property from functioning properly.  I replaced it with the "Scripting.FileSystemObject" object, which appears to be working fine.  

Judging from articles on the web, this seems to be a farily common problem.  I plan not to use the FileSearch property in future applications...   

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close