Results 1 to 5 of 5

Thread: FileSearch

  1. #1
    Join Date
    May 2007
    Posts
    37

    Unanswered: FileSearch

    I'm using the following code to make sure that a specific file exists.
    On Access 2003 it works fine but on Access 2007 I get an error 2455 on the "FileSearch".

    Set fs = Application.FileSearch
    With fs
    .LookIn = "C:\Windows"
    .FileName = "HebDates.DLL"
    If .Execute > 0 Then
    Else
    MsgBox "File is missing"
    Application.Quit
    Exit Sub
    End If
    End With

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Missing reference!
    Check the references between the two instances of Access via the VBA window > tools > references.

    Let us know what you discover
    George
    Home | Blog

  3. #3
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    make a reference to the scripting runtime object model in tools/references of the vba project

    Dim fs As FileSystemObject
    Set fs = New FileSystemObject

    Dim mypath
    mypath = "C:\myfolder\Myfilename.txt"


    If fs.FileExists(mypath) Then
    do something
    end if
    Dale Houston, TX

  4. #4
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    441
    FileSearch is removed in 2007.

    If Dir("C:\Windows\HebDates.DLL")="" then
    msgbox "oups - missing"
    end if

    Here are some more info on different methods, with code samples and timing http://advisor.com/doc/16279
    Last edited by RoyVidar; 10-08-07 at 18:54. Reason: Forgot to add the link
    Roy-Vidar

  5. #5
    Join Date
    May 2007
    Posts
    37
    Thank you for all contribution. I'v used FileSystemObject.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •