root application STATSDB 0008 0009where the 0008 represents the statistics for a particular month. I have stored the drive:\root\application\STATSDB\ part of the path in the registry with the SaveSettings command.
Private Sub cmdGetFileNames_Click() 'Retrieve file locations paths stored in registry Call LoadFileLocations 'Get first name mstrWorkingString = Dir(mstrUserStatsDBDirectory, vbDirectory) 'Initialize directory count mintDirCount = 0 'Place each name in the array mstrDirList 'Remember to exclude "." and ".." entries Do While mstrWorkingString <> "" 'Stop when DIR function returns empty string If mstrWorkingString <> "." And _ mstrWorkingString <> ".." Then 'exclude the "." and ".." directories 'Redimension the array ReDim Preserve mstrDirList(mintDirCount) 'Valid name, store in array mstrDirList(mintDirCount) = mstrWorkingString 'Increment directory count mintDirCount = mintDirCount + 1 End If 'Get next name mstrWorkingString = Dir Loop 'mstrWorking String <> "" 'Correct the Directory count for the last increment mintDirCount = mintDirCount - 1 'Retrieve file names 'Read each subdirectory 'Initialize loop counter mintLoopIndex1 = 0 'Initialize the File Counter mintFileCount = 0 For mintLoopIndex1 = 0 To (UBound(mstrDirList)) 'Process all directories in mstrDirList 'Append subdirectory to the path, 'don't forget to add the "\" at the end mstrWorkingPath = mstrUserStatsDBDirectory & _ Trim(mstrDirList(mintLoopIndex1)) & _ Chr(92) 'Get first name mstrWorkingString = Dir(mstrWorkingPath, vbNormal) 'Place each MDB file name in the array mstrFileList 'Remember to exclude "." and ".." entries Do While mstrWorkingString <> "" If mstrWorkingString <> "." And _ mstrWorkingString <> ".." And _ Right(Trim(mstrWorkingString), 3) = "mdb" Then 'Redimension the array ReDim Preserve mstrFileList(mintFileCount) 'Valid name, store in array mstrFileList(mintFileCount) = mstrWorkingPath & _ mstrWorkingString 'Increment the file count mintFileCount = mintFileCount + 1 End If 'Get next name mstrWorkingString = Dir Loop 'mstrWorkingString <> "" Next 'mintLoopIndex1 to UBound(mstrFileList) 'Correct the file count for last increment mintFileCount = mintFileCount - 1 'Display the results in the listbox 'Initialize the loop counter mintLoopIndex1 = 0 'Make sure the file list is empty lisUserStatsDatabases.Clear For mintLoopIndex1 = 0 To UBound(mstrFileList) lisUserStatsDatabases.AddItem mstrFileList(mintLoopIndex1) Next 'minitLoopIndex1 'Show the listbox frame fraFileList.Visible = True End Sub