Colin
I think the last 6 characters of UK postcodes are always
NUMBER-SPACE-NUMBER-LETTER-LETTER. The following query works for whole postcodes (with a
space between the two elements).
Create a select query. In the first column enter this expression:-
Expr1: IIf(IsNumeric(Mid([POSTCODE],InStr([POSTCODE],"
")-2,1)),[POSTCODE],Left([POSTCODE],InStr([POSTCODE]," ")-2) & "0" & Right([POSTCODE],5))
Sort this column Ascending, but don't show it. Insert your POSTCODE field as the second
column, and show it.
HTH
Andrew L.
"Peter R. Fletcher" <pfletch(at)fletchers(hyphen)uk.com> wrote in message
I looked at the KB article - it won't help you because it relies on
there being one and only one alpha character. As I said, it is the
fact that a postcode may have one or two alpha characters that causes
the problem. What's wrong with the VBA approach I suggested?
On Wed, 5 May 2004 11:54:56 -0700, "Colin"
Thanks Peter for your time in replying.
There is an article in the microsoft knowledge base no.
Q209632. It shows how to sort alphanumeric strings, but
is the other way round to the UK postcodes?? Ther must be
a way??
I'll plod on.Thanks, Colin.
-----Original Message-----
UK Postcodes are such fun! The easiest approach is
probably to write
little functions which return the two separate parts of
the postcode
(one as a string and the other as an integer) and use
their return
values in sorted hidden fields in your queries I don't
think that
there is "an expression I can type into my query"! It is
the fact that
the alpha component can be either one or two characters
that really
makes "single line solutions" difficult to come up with.
On Wed, 5 May 2004 05:38:58 -0700, "Colin"
Hi, i would be grateful for some help. I have around
400
postcodes that i would like to sort.The issue is that
it
sorts as follows BB1, BB11, BB12, BB2, BB23 etc.
I would like it sorted numerical, as well as
alphabetical
ie. BB1, BB2, BB11, BB12, BB23. The UK postcodes start
with either 1 or 2 letters (alphabetical) 'b' or 'bb'
and
finish with 1 or 2 numbers ie '1' or '12' with no
leading
zero's.
Has anyone an expression i can type into my query.
Thanks
in advance. Colin.
Please respond to the Newsgroup, so that others may
benefit from the exchange.
Peter R. Fletcher
.
Please respond to the Newsgroup, so that others may benefit from the exchange.
Peter R. Fletcher