Re: Querying for postcodes within an address against another maste
- From: "John Spencer" <spencer@xxxxxxxxx>
- Date: Mon, 22 Jan 2007 14:26:53 -0500
Trim(Mid([Run_Point_Address_A],InStr(1,[Run_Point_Address_A],",")+1))
This works from the inside to the outside so the first thing that happens is
InStr(1,[Run_Point_Address_A],",") finds the location of the comma and then
we add 1 to we have the position of the first character after the comma.
Mid([Run_Point_Address_A],InStr(1,[Run_Point_Address_A],",")+1) returns the
string from the position to the end of the string. The number of characters
to return is not specified, so mid defaults to all the characters from the
start position to the end position.
Trim simply chops off any leading or trailing spaces. This is handy since
users are prone to entering no spaces to multiple spaces after a comma.
Normally one space, but sometimes none and sometimes 2 or 3 (or more).
xxx, AL 21
xxx, AL 21
xxx,AL 21
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
"efandango" <efandango@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:528DDCD6-D791-4603-9AB3-93FCCEAC739A@xxxxxxxxxxxxxxxx
John,
Thanks for helping with my problem, After a fair bit of trial and error
I'm
happy to say that your Formula helped immensly. What I had to do in order
for
it to work for me was to create a Union Query, taking the 8 Venue and
address
per run and get it down to a 2 field array. Once i did that, i was able to
use your Formula against this 2 field array. I also had to change the
field
definitions from:
Field: PostCodeFrom: Trim(Mid(Run_From,Instr(1,Run_From,",")+1))
TO
PostCodeFrom:
Trim(Mid([Run_Point_Address_A],InStr(1,[Run_Point_Address_A],",")+1))
to reflect the only relevant fields in the new unionised and slimmed down
table .
The only thing is i'm not sure what the various syntax means in your
formula, i tried to look them up referencing things like 'Trim and Instr,
but
couldn't figure out how the whole formuala actually works. Can you
explain?
in the meantime,
THANKS
regards
Eric
"John Spencer" wrote:
What I gave you can be used in a query as a calculated column.
Field: PostCodeFrom: Trim(Mid(Run_From,Instr(1,Run_From,",")+1))
As for the rest of what you are trying to do, I thought you already had
a solution, but just needed to solve this problem.
Since I don't know what is in your "sub table" in terms of fields, I am
unsure of how to advise you.
The speed of anything you do would significantly improve if you had the
Postcodes in separate fields. I suspect that you could use an non-equi
join in a query using the calculated value as part of the join and
joining to two instances of your "sub table" from each of the From and
To postcode calculations.
efandango wrote:
John,
Yes, The comma only ever appears after the postcode. (if any errors
throw,
I'll manually reconfigure them)
Can you give me some pointers on how/where to use your formula,
Query/VBA?.
Also, Is it possible to be able to compare both 'From_Pcode' and
'To_Pcode'
in the master table with the 'comma' postcodes in the sub table. or
will it
require two seperate processes?.
Am i making sense? (already my head is spinning...) :)
.
- Follow-Ups:
- References:
- Querying for postcodes within an address against another masters t
- From: efandango
- Re: Querying for postcodes within an address against another masters t
- From: John Spencer
- Re: Querying for postcodes within an address against another maste
- From: efandango
- Re: Querying for postcodes within an address against another maste
- From: John Spencer
- Re: Querying for postcodes within an address against another maste
- From: efandango
- Querying for postcodes within an address against another masters t
- Prev by Date: Re: Append qry only works the second time
- Next by Date: Re: Append qry only works the second time
- Previous by thread: Re: Querying for postcodes within an address against another maste
- Next by thread: Re: Querying for postcodes within an address against another maste
- Index(es):
Relevant Pages
|