I have to update an older 2003 mdb that was using the filesearch property in code attached to the autoexec macro (see below). It would scan over the contents of a folder containing .pdf documents and build a list of all the .pdfs and make them available for viewing. Can someone help me out and show me what needs to be changed in order to make this thing work with access 2010? Thank you so much.
'Dim MySearch As Office.FileSearch
Dim intI As Integer, strPath As String
strPath = "J:\HR\BENEFITS\OPT OUT CREDIT\SUPPORTING DOCS"
Set MySearch = Application.FileSearch
.NewSearch 'initialize a new search
.LookIn = strPath 'starting point for search
.FileName = "*.pdf" 'filename...accepts wildcard character
.SearchSubFolders = True 'scan folders inside first folder, set to False if not desired
.Execute '.FoundFiles will contain the list of PDF files found as a collection
For intI = 1 To .FoundFiles.Count
DoCmd.RunSQL "Insert into tbl_TempFileNames(PDF_filename) values ('" & .FoundFiles(intI) & "')"