UK postcode field validation

Phonik

Registered User.
Local time
Today, 12:56
Joined
Sep 22, 2006
Messages
111
Hi,

I have a postcode field on a form that allows 8 characters. e.g. ST10 8BY including the space in the middle.
The only validation I have been able to use thus far is the above but I would like to know how to validate two letters (AA) then between 1 and 2 numbers (11) etc.

Is there any code/built in functions that allows this. I know there is an input mask but if I use that, I can set the poscode format up like ST10 8BY but it thinks that the rule has been broken if the postcode was changed to S10 8BY by removing the T. This is also a valid postcode.

Does anyone have any suggestions?

Thanks
 
Have a look here

or do a search for postcode validation, this crops up regularly and there are many examples posted.

Col
 
Col,

Thanks for your response. I will have a look.

Gaz
 
Try this function
If "AA" <> Right(Me.txtYourTextBox.Value, numberofcharacters). Example:
If "AA" <> Right(Me.txtYourTextBox.Value, 3) Then
etc.etc.etc............
Is also available with left instead of right
 

Users who are viewing this thread

Back
Top Bottom