Solved Postcode Clicpper (1 Viewer)

Number11

Member
Local time
Today, 14:21
Joined
Jan 29, 2020
Messages
471
So i am using this to cut down the postcode to just show first two letters and any following numbers

ShortPostCode: Left([post code],InStr([post code]," ")-1)

result : S2


however this is causing a
1629817783437.png


If i use this code its all Ok, but its not doing what the first code is..

ShortPostCode: Left([post code],4)

result: S2 4
 

Gasman

Enthusiastic Amateur
Local time
Today, 14:21
Joined
Sep 21, 2011
Messages
10,296
You have postcode with no space?
That will return 0
 

Number11

Member
Local time
Today, 14:21
Joined
Jan 29, 2020
Messages
471
So maybe its worth adding a new field to the table "ShortPostCode" and use the 1st code to create the postcodes, maybe create a query to shorted and then an append query to update the table?
 

isladogs

CID VIP
Local time
Today, 14:21
Joined
Jan 14, 2017
Messages
16,055
No need to do that.

The problem with using the first 4 characters is that the inward part of the postcode (area & district) can vary in length from 2 to 4 (or occasionally 5) characters. e.g. L2 ; BS27
As already stated, postcodes aren't always written with a space before the outward part of the postcode (which is always the last 3 characters)

A reliable way of achieving what you want is to omit the last 3 characters.
That will always work whether or not there is a space

Code:
ShortPostcode: Trim(Left(Postcode, Len(Postcode)-3))

Using Trim removes any trailing space
 

Number11

Member
Local time
Today, 14:21
Joined
Jan 29, 2020
Messages
471
No need to do that.

The problem with using the first 4 characters is that the inward part of the postcode (area & district) can vary in length from 2 to 4 (or occasionally 5) characters. e.g. L2 ; BS27
As already stated, postcodes aren't always written with a space before the outward part of the postcode (which is always the last 3 characters)

A reliable way of achieving what you want is to omit the last 3 characters.
That will always work whether or not there is a space

Code:
ShortPostcode: Trim(Left(Postcode, Len(Postcode)-3))

Using Trim removes any trailing space
ok so no thats didnt work now getting
1629824512834.png
 

Number11

Member
Local time
Today, 14:21
Joined
Jan 29, 2020
Messages
471
ok found the issue the table it was looking upto had @ in format removed that an sorted now thanks :)
 

Users who are viewing this thread

Top Bottom