Using MS-Access 2000, I have a form which searches a specified directory for text files (hyphen delineated) which are then imported into a table so that order information can be extracted.
Dim stFileName As String
Dim stDateFilter As String
Dim Folder As String
stDateFilter = DLookup("[msoDateFilter]", "[tMsoDateFilter]", "[DateFilter] = '" & Me.DateFilter & "'")
Application.FileSearch
.NewSearch
stFileName = Nz(Me.TxtFilter, "") & "*." & Nz(Me.TxtExtension, "") & "*"
.FileName = stFileName
.LastModified = stDateFilter
.LookIn = Folder
.Execute
I want to narrow the search according to a time frame, and .LastModified works fine if I hard code it in, like "msoLastModifiedToday", but when I tried to use a variable, using the DLookup above, the variable comes up with the correct value (stDateFilter = "msoLastModifiedToday") but I get a "Run-time Error 13, Type mismatch" at that line.
Is there a problem with using a variable for that line, or am I doing something wrong? I tried running stDateFilter as a Variant, but that had no effect.
-Cevin