|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
application.filesearch
I am creating a list of all pdf files in a folder on the LAN that contain the string *SO*.pdf in them. I am then traversing the directory structure and processing the files. What I am running into is that I can only have 652 foundfiles. My index value for i is always 652. After that the program just acts like there are no more entries. Any thoughts? Is there a maximum number of .foundfiles? Can I redimension?
Scott Set fs = Application.FileSearch DoCmd.Hourglass True varReturn = SysCmd(acSysCmdSetStatus, "Processing... ") With fs .LookIn = vDefPath .SearchSubFolders = True .FileName = "*SO*.pdf" If .Execute(SortBy:=msoSortbyFileName, SortOrder:=msoSortOrderAscending) > 0 Then varReturn = SysCmd(acSysCmdSetStatus, "Processing... " & .FoundFiles.Count & " files...") 'MsgBox "There were " & .foundfiles.Count & " file(s) found." For i = 1 To .FoundFiles.Count 'MsgBox .FoundFiles(i) vso = getso(.FoundFiles(i)) varReturn = SysCmd(acSysCmdSetStatus, "Processing... " & i & " of " & .FoundFiles.Count & " files...") If (vso <> "") Then vSQL = "update serviceorder set SOPath = '" & .FoundFiles(i) & "' where ID = " & vso Debug.Print vSQL DoCmd.SetWarnings False DoCmd.Hourglass True DoCmd.RunSQL vSQL DoCmd.Hourglass False DoCmd.SetWarnings True End If Next i Else MsgBox "There were no files found in " & vDefPath End If End With |
|
#2
|
|||
|
|||
|
There is no known limit for .filesearch. Have you declared i as Long?
Also, the code is confusing where there is a single quote before the message boxes. If (vso <> "") should be If (vso <> 0). Finally, your vSQL statement seems to be wrong. I posted a few minutes ago a note regarding using single quotes because of cross platform compatibility and string data which itself can contain a single quote. This will cause an error when the SQL statement is executed. Also, proper bracketing of SQL parameters is very important. The inconvenience of using double quotes as = " & Chr(34) & . . . . in SQL statements will pay off. Take it from someone who has been there lots of times. ![]() |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > application.filesearch |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|