I have a database and use part of it for billing. I create a file and upload it to a site. The structure of the file is M123456.1. The next file generated would be M123456.2, and so on. In order to keep the folder cleaned out and make it easy to identify the file to upload, I get rid of similar files in the folder with the following line of code:
If Dir("C:\Folder1\Folder2\M*.*") <> "" Then Kill "C:\Folder1\Folder2\M*.*"
I would like to use this for something similar. Instead of using the M123456 as the file name to delete, I would like to use a field name on a subform from where this code is activated. This field is used to identify customers. For example, if the Customer ID is 123456, I would like to delete all files that start with that number. I can’t get it to work.
If Dir("C:\Folder1\Folder2\CustomerID") <> "" Then Kill "C:\Folder1\Folder2\CustomerID"
Any ideas?
Thank you.
If Dir("C:\Folder1\Folder2\M*.*") <> "" Then Kill "C:\Folder1\Folder2\M*.*"
I would like to use this for something similar. Instead of using the M123456 as the file name to delete, I would like to use a field name on a subform from where this code is activated. This field is used to identify customers. For example, if the Customer ID is 123456, I would like to delete all files that start with that number. I can’t get it to work.
If Dir("C:\Folder1\Folder2\CustomerID") <> "" Then Kill "C:\Folder1\Folder2\CustomerID"
Any ideas?
Thank you.