Solved

Application.FileSearch.Execute() not working

Posted on 2007-11-29
3
1,634 Views
Last Modified: 2013-11-28
.Execute() always return 0 even though the file is in the searching folder. I have MS office 2003. Can someone help me?

sDir = Application.CurrentProject.Path
    sTable1 = "tbl_Projects"
    sFile1 = "PROJECTS.TXT"
   
        With Application.FileSearch
            .NewSearch
            .LookIn = Application.CurrentProject.Path
            .FileName = sFile1
            .MatchTextExactly = True
           
            If .Execute() > 0 Then
           
         
                DoCmd.Hourglass True
       
                'Delete existing lists
                DoCmd.SetWarnings False
                DoCmd.OpenQuery "qdel_AllRecords_from_ProjectsTable"
                DoCmd.SetWarnings True
               
                'Import updated lists
                DoCmd.TransferText acImportDelim, , sTable1, sDir & "\" & sFile1, True
               
                'Success
                MsgBox "Project List Update Complete."
            Else
                MsgBox "Import file not found"
            End If
        End With
0
Comment
Question by:iomosaic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 85
ID: 20374233
Are you trying to determine if the file PROJECTS.TXT exists in the current project's path? If so, a much easier way is like this:

If Dir(CurrentProject.Path & "\PROJECTS.TXT") <> "" Then
  '/file exists
Else
  Msgbox "Import File Not Found"
End If
0
 

Author Comment

by:iomosaic
ID: 20374281
but the code works on my other machine. I'm wondering if three is some issue with references that I'm overlooking?
0
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 20375164
Possibly, or it could be disabled. The FSO can be disabled by an antivirus engine or network admin (which is why I avoid it altogether).
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question