I have inherited a small DB in my office and was wondering if someone could
provide some advice. Currently the DB allows the office manager to archive
the data for each year under the DB's program folder. These folders are named
after the year eg 2005, 2006, 2007 etc, and these folders do not contain any
text in their name.
The DB uses the following code to check that the selected folder is actually
under the program's folder:
************
ProgramPath = [Application].[CurrentProject].[Path]
ArchiveFolder = BrowseForFolderByPath(ProgramPath)
'check if user has clicked the Cancel button.
If ArchiveFolder = vbNullString Then
Exit Sub
End If
'check if the selected folder is under the program folder.
If Left(ArchiveFolder, Len(ArchiveFolder) - 5) <ProgramPath Then
MsgBox "That is an invalid Archive folder." & Chr$(13) & Chr$(13)
& _
"Archives are located in the " & ProgramPath & " folder." & Chr$
(13) & Chr$(13) & _
"Please select an archive in the " & ProgramPath & " folder.",
vbOKOnly +
vbInformation, "Invalid Archive Folder."
Exit Sub
End If
**************
Some of the office staff are selecting the wrong folder under the program
folder. I would like to know how to code the situation where if a user
selects a subfolder under the program folder that is not 2005, 2006 or 2007
etc then the application says "Invalid Folder" when they click OK on the
Browse for Folder dialog box. In other words, I would only like to have them
select the folders that contain only numbers in their name.
Is this possible?
Many thanks,
Anthony
--
Message posted via http://www.accessmonster.com