Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Different Formats for Postcode field

Status
Not open for further replies.

drbtodd1971

Programmer
Mar 28, 2007
34
Hi,

I've been given a spec for a new database and the Postcode field (Equivalent of Zip code in America) has to be a text string of 8 ascii characters which could be in any of the following formats: L = Letter N = Numeric
LN NLL
LNN NLL
LLN NLL
LLNN NLL
LLNL NLL
There must be a space in front of the last three chars. Where a Postcode is less than 8 characters (including the space) additional spaces should be included at the end.

I did some searching on forums and found some code called Regexp which did some sort of pattern matching but I don't think it's compatible with Access or is it? I'm running Access2000. Do I need to use mid and some sort of padding command?
 
you're not working for the NHS are you...

you can use the format functionality on access forms to enforce that formatting during entry, however in the back end, I would just write a function to check wether a post code is in the correct format

--------------------
Procrastinate Now!
 
You can use RegExp with Access 2000, you will need to create an object:

CreateObject("vbscript.regexp")

or add a reference.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top