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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing last two characters from a field (Post Code) 1

Status
Not open for further replies.

Deano1976

Technical User
Dec 16, 2004
41
GB
MS Access 95

I would like to know how I can remove the last two characters from a field using a query.

The field is a post code field which sometimes has the post code entered with a space and sometimes without.

e.g.

NR11 8DD
NR118DD

For both of these examples I only want to remove the last two characters - DD and be left with NR11. I pressume I can use the rtrim function to get rid of any spaces after that.
 
Code:
Left([PostCode], Len([PostCode])-2)

except that, with your examples you will be left with
[tt]
NR11 8DD ---> NR11 8
NR118DD ---> NR118
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top