473,405 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Verifying folder name

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

May 17 '07 #1
2 1454
Hi Anthony.

I noticed you solved this with:
<snip>
(Right(ArchiveFolder, 4)) Like "*[!0-9]*" Then

Here's a quick experiment from my DeBug window (Access 97)
? IsNumeric("2005")
True

? IsNumeric("2005a")
False

'Nuff said?

Cheers,
Alan
May 22 '07 #2
Hi Alan,

Thank you. Sometimes we miss the bleeding obvious!

Regards
Anthony

Alan Carpenter wrote:
>Hi Anthony.

I noticed you solved this with:
<snip>
(Right(ArchiveFolder, 4)) Like "*[!0-9]*" Then

Here's a quick experiment from my DeBug window (Access 97)

? IsNumeric("2005")
True

? IsNumeric("2005a")
False

'Nuff said?

Cheers,
Alan
--
Message posted via http://www.accessmonster.com

May 22 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: jenny | last post by:
Hi, I am trying to find a VB way that would create a folder on all existing drives - the folder name would be the same on each drive. ie c:\backup, d:\backup, etc. But the folders would only be...
4
by: HD | last post by:
Hi, I was wondering if there is a way of verifying information that is in the registry of the user's computer??? Or is there a way of checking if a file is on the c:\ of the user's computer?? I...
9
by: Carter Smith | last post by:
http://www.icarusindie.com/wiki/index.php/Server-Side_Javascript_Check Sample source included This method requires that your pages are PHP enabled and you have mySQL. Although I suppose you...
10
by: Doug O'Leary | last post by:
Hey, all. I have a perl script which generates the html listed below. I cleaned it up a bit since the perl CGI module creates some really ugly html code. I've looked at this thing 8 ways to...
0
by: John H. | last post by:
In effort to understand (Outlook) MAPI folder tree structure wrote simple linear code below to navigate tree. Successive "...Folders.GetNext()"'s return same folder at all levels of tree. What...
4
by: Reinhold Schalk | last post by:
Hello, somewhere i've read that using strong names does assure two things: 1. Assure that the content of the assembly is not modified (that's ok in my opinion) 2. Assure that the assembly is...
6
by: John | last post by:
Hi I have several web forms that require users verification by entering a code before they are allowed in. I have created a separate web form for entering and verifying user code. How do I...
1
by: koch.henning | last post by:
Hello, I have some sort of problem with verifying the contents of my xml-document. I have a xml-scheme like this... <xs:complexType name="abcType"> <xs:sequence> <xs:element name="elementA"...
9
by: Keith G Hicks | last post by:
I'm having a lot of trouble with "file in use" errors in my "folder watcher" project. Starting and stopping the watcher and reading my XML file work fine. Once the watcher is started, I'm reading...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.