473,395 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

postcode lookup

I have a field for a postcode. I'd like another field to auto contain an
'area' number, based on the first part (only) of the postcode. For example,
if a postcode LS4 4DJ was entered, another field would read the LS4 part and
enter '7' in that new field.

I have a table that contains an up to date list of just these first-part
postcodes...

Thanks,
Lap
Nov 12 '05 #1
5 4097
I assume your second table (TblAreas) looks like
SmallPostCode Area
LS 7
CO 5
etc

Create a query (QSmallPostCode) based on your table containing the post
codes containing the following
SmallPostCode:IIf(Len([PostCode])>=2,Left$([PostCode],2),"")
This extracts the first 2 letters (nothing for a missing post code

Then create a second query based on TblAreas and QSmallPostCode with a left
join between the 2 SmallPostCode fields

See if that gets you on your way

Phil

"Lapchien" <cc****@nospamplease.eclipse.co.uk> wrote in message
news:10***************@ananke.eclipse.net.uk...
I have a field for a postcode. I'd like another field to auto contain an
'area' number, based on the first part (only) of the postcode. For example, if a postcode LS4 4DJ was entered, another field would read the LS4 part and enter '7' in that new field.

I have a table that contains an up to date list of just these first-part
postcodes...

Thanks,
Lap

Nov 12 '05 #2
Just use a case statement

Select Case Postcode
Case Trim(left(Postcode,3))="LS4"
Area = 4
Case Trim(left(Postcode,3))="LS5"
Area =5
Case.......
Area......
End Select

Patrick

On Mon, 1 Dec 2003 13:16:29 -0000, "Lapchien"
<cc****@nospamplease.eclipse.co.uk> wrote:
I have a field for a postcode. I'd like another field to auto contain an
'area' number, based on the first part (only) of the postcode. For example,
if a postcode LS4 4DJ was entered, another field would read the LS4 part and
enter '7' in that new field.

I have a table that contains an up to date list of just these first-part
postcodes...

Thanks,
Lap


Nov 12 '05 #3
Thanks - I'll let you know how I get on...
--
Thanks,
Chris
cc****@NOSPAMeclipse.co.uk

"Phil Stanton" <di********@stantonfamily.co.uk> wrote in message
news:3f***********************@mercury.nildram.net ...
I assume your second table (TblAreas) looks like
SmallPostCode Area
LS 7
CO 5
etc

Create a query (QSmallPostCode) based on your table containing the post
codes containing the following
SmallPostCode:IIf(Len([PostCode])>=2,Left$([PostCode],2),"")
This extracts the first 2 letters (nothing for a missing post code

Then create a second query based on TblAreas and QSmallPostCode with a left join between the 2 SmallPostCode fields

See if that gets you on your way

Phil

"Lapchien" <cc****@nospamplease.eclipse.co.uk> wrote in message
news:10***************@ananke.eclipse.net.uk...
I have a field for a postcode. I'd like another field to auto contain an 'area' number, based on the first part (only) of the postcode. For

example,
if a postcode LS4 4DJ was entered, another field would read the LS4 part

and
enter '7' in that new field.

I have a table that contains an up to date list of just these first-part
postcodes...

Thanks,
Lap


Nov 12 '05 #4

In the AfterUpdate event of the postcode field Try:-

Me.AreaCode = Mid(PostCode, 1, InStr(PostCode, " ") - 1)
On Mon, 1 Dec 2003 13:16:29 -0000, "Lapchien"
<cc****@nospamplease.eclipse.co.uk> wrote:
I have a field for a postcode. I'd like another field to auto contain an
'area' number, based on the first part (only) of the postcode. For example,
if a postcode LS4 4DJ was entered, another field would read the LS4 part and
enter '7' in that new field.

I have a table that contains an up to date list of just these first-part
postcodes...

Thanks,
Lap


Nov 12 '05 #5
On Mon, 01 Dec 2003 17:12:33 GMT, pe********@mcmail.com wrote:
Sorry did not notice the "enter '7' in that new field"
'Presuming that LS4 is 7 in your area's Table

Try this

Private Sub PostCode_AfterUpdate()

Dim strAreaCode As String
strAreaCode = Mid(PostCode, 1, InStr(PostCode, " ") - 1)
AreaCode = DLookup("Areacode", "tblAreas", "postcode ='" & strAreaCode
& "'")
End Sub

In the AfterUpdate event of the postcode field Try:-

Me.AreaCode = Mid(PostCode, 1, InStr(PostCode, " ") - 1)
On Mon, 1 Dec 2003 13:16:29 -0000, "Lapchien"
<cc****@nospamplease.eclipse.co.uk> wrote:
I have a field for a postcode. I'd like another field to auto contain an
'area' number, based on the first part (only) of the postcode. For example,
if a postcode LS4 4DJ was entered, another field would read the LS4 part and
enter '7' in that new field.

I have a table that contains an up to date list of just these first-part
postcodes...

Thanks,
Lap


Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tom | last post by:
If anyone is looking for a cost effective postcode finder try this http://www.postcodeanywhere.co.uk/ it is brilliant and very easy to use
5
by: Alan | last post by:
Hi, I'm getting as bit confused with my queries. I simply (!) want to insert a space into a postcode field the 4th character from the right, so, for example, ML201TQ becomes ML20 1TQ, which is...
6
by: Julian | last post by:
Hi, I am a very beginner in databases. I created a database table in Access 2003 and OOo 2.03 that includes name, address, postcode, phone numbers etc of our customers. I would like to sort...
3
by: mark | last post by:
I have a table of UK companies whose records I want to filter using a map of postcode regions. For the benfit of people outside the UK, our postcodes are a pain to work with because they are not...
12
by: xhe | last post by:
I am now developing a website which needs Canadian PostCode Database. I can certainly buy one, but that will cost my hundered of $$, and my website is only for education purpose, it won't make...
1
by: Mike P | last post by:
Can anyone recommend some good postcode lookup software for UK postcodes that can be integrated into your own applications? Many thanks, Mike
5
by: billynastie2007 | last post by:
Hi i am writing a balloon race site and i am having problems with some functions to calculate the distance the balloon travels firstly i am reading my info from the database using the fetch assoc...
0
by: Pinna | last post by:
Hiya, I am trying to select based on a range on postcode on a table. The field POSTCODE is a varchar2(8). The problem is when refinng on 'where postcode between 'PE1' and 'PE29'', because this is...
1
by: dominicowen | last post by:
Hi, I have a customer database in Access 2003 with customers postcodes. What I want to do is type in a postcode on access and it will link the postcode on to googlemaps without having to type...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.