MS-Access nested DIR - check if a file exists elsewhere whilst looping through a folder
- by David Carle
I have used the DIR() command in Microsoft Access 2003 to loop through the files in folder A. This works fine, but I need to check if each file also exists in another location (folder B), and only process the file if it doesn't exist in folder B.
The problem is that checking for the file existing in folder B also uses the DIR() function and this then resets or confuses the original one, with the result that no further files are found in folder A.
Is there a way to check if a file exists without using DIR?
Or, is there a way to have a separate instance of DIR?
I suppose I could build a list of the files in folder A into an array and then process the entries in the array, but this seems rather 'clunky'
Any suggestions for a better solution?
Thanks