Charlotte Foust
cfoust at infostatsystems.com
Mon Apr 28 13:52:44 CDT 2003
Not at this late date. I pulled that code out of my archives and haven't rechecked it. Maybe someone else can help you if you need an answer in a hurry because I'm up to my eyes in work right now. Charlotte Foust -----Original Message----- From: Jim DeMarco [mailto:Jdemarco at hshhp.org] Sent: Monday, April 28, 2003 6:04 AM To: accessd at databaseadvisors.com Subject: RE: [AccessD] FileSearch object Charlotte, I tried your code and I get an "Invalid procedure call or argument" error on the line: .FileName = strLike. I've hard coded strLike to equal "*.*" and have tried "c*" with the same result. If I comment out this line I get a return of the files (including path) in the folder I'm looking at. Any idea why this happens. Thanks, Jim DeMarco Director of Product Development HealthSource/Hudson Health Plan -----Original Message----- From: Charlotte Foust [mailto:cfoust at infostatsystems.com] Sent: Sunday, April 27, 2003 4:57 PM To: accessd at databaseadvisors.com Subject: RE: [AccessD] FileSearch object I've used it because it is flexible and easy. The alternatives are what, Dir? Not much of an alternative. Or are you asking about using it instead of the FileSystemObject? One thing I like about it is that it returns a FoundFiles collection that you can iterate through. Another is that you can specify multiple specifications as a semicolon delimited list in the FileName argument, which makes it very flexible. Here's something I built to return a list of files using FileSearch. The idea was to present the user with a dropdown list of files that matched any passed specifiications without using the common dialog. Public Function BuildFileList(ByVal strPath As String, _ Optional strLike As String) As String 'Created by Charlotte Foust 4/18/2000 Dim strList As String Dim intLoop As Integer 'If no filename comparison 'was passed, look for all. If strLike = "" Then strLike = "*.*" End If With Application.FileSearch .NewSearch .LookIn = strPath .FileType = msoFileTypeAllFiles .FileName = strLike If .Execute() > 0 Then For intLoop = 1 To .FoundFiles.Count 'concatenate the filename to the list strList = strList & ExtractFileName(.FoundFiles(intLoop)) & ";" Next intLoop End If End With If Len(strList) > 0 Then 'If a list was created, remove 'the last delimiter. strList = Left(strList, Len(strList) - 1) End If BuildFileList = strList End Function Charlotte Foust -----Original Message----- From: Susan Harkins [mailto:harkins at iglou.com] Sent: Saturday, April 26, 2003 3:48 PM To: AccessD at databaseadvisors.com Subject: [AccessD] FileSearch object I'm trying to come up with a good reason for bothering to use the FileSearch object -- so far the only thing I've come up with is wanting to control the search process by being inclusive or exclusive with search parameters. Anyone ever used it and if so, why? Susan H. _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com ************************************************************************ *********** "This electronic message is intended to be for the use only of the named recipient, and may contain information from Hudson Health Plan (HHP) that is confidential or privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this message is strictly prohibited. If you have received this message in error or are not the named recipient, please notify us immediately, either by contacting the sender at the electronic mail address noted above or calling HHP at (914) 631-1611. If you are not the intended recipient, please do not forward this email to anyone, and delete and destroy all copies of this message. Thank You". ************************************************************************ *********** _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com