473,804 Members | 3,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4118
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:I If(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****@nospamp lease.eclipse.c o.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(Postc ode,3))="LS4"
Area = 4
Case Trim(left(Postc ode,3))="LS5"
Area =5
Case.......
Area......
End Select

Patrick

On Mon, 1 Dec 2003 13:16:29 -0000, "Lapchien"
<cc****@nospamp lease.eclipse.c o.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****@NOSPAMec lipse.co.uk

"Phil Stanton" <di********@sta ntonfamily.co.u k> wrote in message
news:3f******** *************** @mercury.nildra m.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:I If(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****@nospamp lease.eclipse.c o.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****@nospamp lease.eclipse.c o.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********@mcma il.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_AfterU pdate()

Dim strAreaCode As String
strAreaCode = Mid(PostCode, 1, InStr(PostCode, " ") - 1)
AreaCode = DLookup("Areaco de", "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****@nospam please.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
2144
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
6250
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 the post offices format. Unfortunately I've been given a database with postcodes that don't have this space. Thanks
6
3371
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 customers by areas of London, UK by the first part of the postcode. The London postcodes are the form of E19 4PR, NW5U 4RT. So I would like to print a report (customers arranged into Word tables - normal tables, not database tables) for example which...
3
2942
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 a standard length, and the part which identifies the region isn't a standard length either. The first letters of the postcode denotes a general region, and then sub-regions are denoted by the following numbers and letters.
12
1926
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 money. So I am afraid I can not affort it. Are there any good friends who can share me with you Canadian PostCode database, I need the longitude and latitude included in the DB. Thank you very very much in advance. If you still have other country's...
1
2528
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
2369
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 function what i have is 2 table one for the race details and one for the postcode details what i am having problems with is listing all the races in the database then having a coloumn at the end which tell you how far the balloon has travelled i have...
0
2028
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 a character field and not a number field, 'PE3','PE4','PE5','PE6','PE7','PE8','PE9' are all ignored because the construct orders in characters and then numbers and as a result the query excludes it. Can anyone provide some code to overcome this...
1
2043
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 it in google map. So far I just got the command button which opens the query for me to type a postcode and it just links to google map but doesnt carry on the search for the postcode I entered. Hope this makes sense
0
9707
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9585
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10338
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10323
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5658
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2997
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.