Application.FileSearch in MS Access 2007

I recently wrote a small application for someone using Microsoft Access 2003 and found the Application.FileSearch method of enumerating files is no longer available. The older “dir” function is still available so I replaced it with the following code to change the current drive and path and enumerate the files. Note this code will only work for local drive paths, not UNC style network paths.

Private Sub Form_Activate()

Dim i As Integer
Dim SearchPath As String
Dim Filename As String

SearchPath = GetPath() & "Backups"
ChDrive Mid$(SearchPath, 1, 2)
ChDir SearchPath
Filename = Dir("*.csv")
While Filename <> ""
  RestoreList.AddItem (Filename)
  Filename = Dir

End Sub