Narrow Search Results in Access

  • Thread starter Thread starter BTU_needs_assistance_43
  • Start date Start date
B

BTU_needs_assistance_43

I've got a chunck of code written that will search for all the .xls files in
a certain folder. That parts great. What isn't great is that the program
searches for ALL .xls files when I only need ones added in the last week or
so. While the .LastModified command works in Excel it will NOT work in Access
and instead of bringing up recent files it brings up all of them. How do I
get this command to work in Access?

With Application.FileSearch
.NewSearch
.LookIn = "C:\Documents and Settings\i62793\Desktop\Rough Drafts\MY
EXPERIMENTS\Cast Report Examples"
.SearchSubFolders = True
.LastModified = msoLastModifiedLastWeek
FileType = msoFileTypeExcelWorkbooks
If .Execute > 0 Then
For i = 1 To .FoundFiles.Count
strLocation = (.FoundFiles(i))

....
 
"Dir$ is a lot faster than using FileSearch, unless many subdirectories need
to be searched or you need to use the advanced features of FileSearch such as
the LastModified property." ... this part kind of jumped out at me when I
read it... thank you though
 
If you've never looked at the mvps.org site, you may want to. There's an
excellent amount of Access - related sample code that will do most
everything, except take out the trash.
 
Back
Top