473,569 Members | 2,490 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 = BrowseForFolder ByPath(ProgramP ath)

'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(ArchiveFol der, Len(ArchiveFold er) - 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 1462
Hi Anthony.

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

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

? IsNumeric("2005 a")
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(Archive Folder, 4)) Like "*[!0-9]*" Then

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

? IsNumeric("2005 ")
True

? IsNumeric("2005 a")
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
7175
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 created if they don't already exist, and if the drive happens to be one a folder cannot be created on (ie a cdrom drive) it would just be skipped...
4
1562
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 want to make a certain verification of who is entering my website... but the IP address is never the same (since it is randomly given to the user)...
9
2092
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 could also use PHP sessions (not cookies as they're client editable). You could actually use any server side scripting language such as Perl or ASP...
10
2826
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 Sunday, but I can't see anything wrong. When I hit the "Add" button, it immediately executes the action of the form skipping the validate_form function...
0
3304
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 am I doing wrong or not understanding? Thanks.
4
1852
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 really from the "fabricator" (?) If these two point are correct (i'm not sure), i have a problem with point 2. To assure the authentity of the...
6
1284
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 incorporate this with web forms that require security? I am very new to this and would appreciation some clarification on how this sort of thing works in...
1
1370
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" type="elementAType"/> <xs:element name="elementB" type="elementBType"/>
9
2906
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 the text files from the watched folder line by line into variables and then posting them to a SQL table. All of the code for the form is shown...
0
7703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7678
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7982
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3656
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.