I'm new to this thread and only skimmed all the previous posts. but as I understand the situation...
You have a "NewFiles" Directory, (FixedPath,) Which Must Not be Changed, and an "AccessFiles" directory, NewPath, which does change from time to time.
All files have one of =Array("TESTMAIN", "TESTCASE", "TESTPRIMARY", "TESTSECONDARY", "TESTALTERNATE") Strings in their Names.
For each file in "NewFiles," if a file with the same inner String exists in "AccessFiles, Append, else Move.
Personally, I would not list any files in a Form Listbox. I might show the current operation in the Status Bar.
I would iterate thru that, (actually a similar) Array, Use Dir to find any and all matching files in NewFiles, compare each to the files AccessFiles and append or move as required.
This is not complete Code, since I don't do Access and OBP is doing an excellent job for you.
Sub Main()
'Iterates thru NewFiles and Checks AccessFiles, decides which sub Procedure to pass FileName to
NewPAth = 'Folder Picker for AccessFiles Folder
StringList = Array("MAIN", "CASE", "PRIMARY", "SECONDARY", "ALTERNATE")
For i = LBound(StringList) to UBound(StringList)
'StatusBar Code
FileName = FixedPath & "*" & StringList(i) & "*"
If Len(FileName) > 1 Then
ExistingFile = CheckFile(NewPath, StringList(i))
If Len(ExistingFile) > 0 Then
AppendFile FileName, NewPath, ExistingFile
Else
MoveFile NewPath, FileName
End If
End If
Next i
End Sub
Function CheckFile(NewPAth As String, InnerString As String) As String
'StatusBar Code
CheckFile = Dir NewPAth & "*" & InnerString & "*"
End Function
Sub AppendFile(FileName As String, NewPath As String, ExistingFile As String)
'StatusBar Code
'Code to open FixedPath & FileName for Append
'Code to Open and append to NewPath & ExistingFile
End Sub
Sub MoveFile(FileName as String, NewPath As String)
'StatusBar Code
'Code to move FixedPath & FileName to NewPath
End Sub