I am by no means an Access or VBA expert; but this is, in my opinion, a very advanced way of programming that will require complex coding if it is even possible--and I need all the help I can get. Below I have provided much detail in a way that, I hope, makes sense to anyone reading it.
We've recently run into a problem with the part of our company database that locates a variety of documents and stores a list of the file names and file locations in a temporary table. This data is compiled from multiple file directories throughout our network based on string criteria and provides the user with an easy to view list formatted using Access 2010. All documents are filed and named specifically and consistently using a different Access database. The file location strings that we use are set, accurate, and should not need modifying. The file name strings, however, are where we've run into a problem. The file names are formatted in this way: "ClientName_yyyy_mm_dd_Document_Name" or "ClientName_yyyy_Document_Name". The problem we have lies within the date (notice that files can be named with the full date or just the year). Our users have requested the ability to edit the document names that are stored/displayed based on a specific date range. Of course, we can use a string filter if we wanted to list documents from one specific date, but they would like a range of dates. In order to do this, I believe, we would have to find a way to search for a specific type of string (based on possible characters used and the format it would be in) in each of the file names, convert this string into a date format that Access recognizes, then perform a mathematical date function to determine if that date falls within the specified range. I'm quite certain that if we are able to extract the appropriate string section then converting that string into a usable date shouldn't be too difficult (we could possibly use the DateValue function or something similar); and if that is achieved then determining whether the date is within range should simply require a precisely calculated If statement. The difficult part, in my opinion, will be the initial event of extracting the string section needed to make all this work. Since the actual string date value will vary with each file name, it is obvious that we cannot search for anything specific. Somehow we will need to create, possibly, a function/module that will recognize when any combination of specified characters (in this case, numbers 0-9) are used in one of two formats ("_####_##_##_" or "_####_"). It will also probably be necessary to include a way to ensure that if more than one of these string sections occur in a file name (which it will because some documents do have two dates), we can then specify which one will be chosen (I am not sure at this time if the first or second date would be preferred by users). Another thing to account for is the fact that the full-date string format contains the same type of string section that would be found when searching for just the year ("_####_"). Therefore, it will be necessary to check for the full-date format first and if that does not exist then check for just the year. If accomplished we will simply then have to tell Access that this string "_####_##_##_" equals this date "_yyyy_mm_dd_" which can hopefully then be recognized, for example, in the short date format (mm/dd/yyyy) which we can then compare to other date variables and perform an action based on that outcome.
Again, I hope that I have explained what we are trying to accomplish in a way that makes sense. If needed, I will provide further information on whatever I am able as it is requested. Unfortunately, I cannot supply any examples of our current code, but I will do my best to explain what it is our existing code does and how if asked of me. I do not expect for someone to successfully compose all of the code necessary to make this possible. I will simply accept and appreciate any and all help given to me--from only being able to inform me of whether or not this feat is even possible, to pointing me in the direction of making it possible, or possibly to providing me with workable code examples of your own (no matter how big or small). Many thanks in advance.