I'm looking for a function that would do the following.
Loop thru all files of a given folder.
Search for files containing some wording in their name "PatMed" for example.
All files are ".txt"
and look for PatientID = 123.
Function should return the entire record
If found more than one, should return all
This should be in order of file created.
If possible, to include in each row, the date/time of file created.
So function should Receive 4 parameters (FolderName, FileName, FieldName, Criteria)
and should either create a file with results, or just return a text delimited string.
Sample of file attached.
PS. Would prefer VBA function.