Input masks for postal codes (UK) in Access

J

James

I've got a database where I have a field for UK postal codes and used the
built-in Access field for Postal Codes (UK ones) that uses the input mask:
LL00\ 0LL;;

This is great for most post codes in the UK that are in the format PL27 8RT
for example, however there are many other UK post codes in the format PL2
7MH or W6 7TY which this input mask will not accept. The built-in input
field will not accept these formats, how do I amend it so that all UK post
codes are acceptable?

Thanks for all answers,

James
 
B

Beth Melton

Since there is such a combination of letters and numbers which vary in
position I don't see a way you can. An input mask is for controlling
the values that can be entered for each character and the data needs
to be fairly uniform. You might be able to come up with something but
the range would be so broad it wouldn't be worth using an input mask
in the first place.

You might check with one of the Access newsgroups since I'd say this
could be done using a couple VBA procedures. Otherwise if it is
validation you are after then you could use a UK postal code table to
populate a list/combo box which is probably how I'd something like
this anyway and I'm fairly certain you could obtain a UK postal code
table on the Internet. Try using Google to search for one.

--
Please post all follow-up questions to the newsgroup. Requests for
assistance by email can not be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/
 
J

James

Hello Beth,

Thanks for the reply. I thought since Mircosoft had provided the input
filter automatically on the wizard specifically for UK postal codes then it
would work for all of them. This is the Microsoft built-in input filter
that is in the UK version of Microsoft Access if you click on Input Mask
Wizard then select Postal Code it displays LN25 4DC for "Data Look" and
LL00 0LL for the Input Mask. Since this is obviously designed in by
Microsoft but isn't correct what are the chances that Microsoft will correct
it to work correctly?

A VBA thingy is beyond my capabilities but I did follow your advice and
download a CSV file of UK codes covering the first part. I'll look at how
to include it in my database. Many thanks.

James
 
B

Beth Melton

I don't think you are following what I was trying to tell you. An
input mask is for uniform data such as the first two characters are
*always* alpha or blank, the next to are *always* numeric or blank,
etc. Such as in the case of a US phone number: (###) ###-#### or a
date: dd/mm/yy, or if every UK postal code were standardized and would
accept LL00 0LL (btw, this mask means the first two characters will be
alpha, the next two numeric, the next numeric, the last two alpha).

You may want to place your cursor in the Input Mask property and press
F1 to read more about how an input mask is intended to be utilized.

Since UK postal codes are not consistent and uniform there is simply
no way to create an input mask for them. The only way Microsoft get an
input mask to work correctly would be to convince the UK to
standardize their postal codes and I doubt that will happen. <grin>

--
Please post all follow-up questions to the newsgroup. Requests for
assistance by email can not be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/
 
J

James

I don't think you are following what I was trying to tell you. An input
mask is for uniform data such as the first two characters are *always*
alpha or blank, the next to are *always* numeric or blank, etc. Such as in
the case of a US phone number: (###) ###-#### or a date: dd/mm/yy, or if
every UK postal code were standardized and would accept LL00 0LL (btw, this
mask means the first two characters will be alpha, the next two numeric,
the next numeric, the last two alpha).

I did follow your reply and understand what you are saying, but I was
disappointed that Microsoft included this supposed UK Postal Code input mask
in Access which is selectable in the wizard but clearly not suitable. The
disappoint comes from spending a lot of time trying to use a built-in Access
feature which is advertised in the product as a UK Postal Code input mask
but clearly not suited to the job. It would have been better if Microsoft
had not included the input-mask on the UK PostCode field that is selected by
the user from the Wizard. I was trying to use a built-in feature that was
available from the Wizard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top