473,659 Members | 3,592 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Remove directionals from a number

All,

I am not well versed in writing code and was looking for some
assistance.

I have the following info.

housenumber directional
1143
1142 N
1134 NE
1135 B

What I am trying to accomplish is the following:

housenumber directional
1143
1142 N
1134 NE
1135 B

This would only pertain to N, NE, NW, S, SE and SW

Any help is greatly appreciated.

Apr 27 '06 #1
3 1254

<Sm******@aol.c om> schreef in bericht news:11******** **************@ y43g2000cwc.goo glegroups.com.. .
All,

I am not well versed in writing code and was looking for some
assistance.

I have the following info.

housenumber directional
1143
1142 N
1134 NE
1135 B

What I am trying to accomplish is the following:

housenumber directional
1143
1142 N
1134 NE
1135 B

This would only pertain to N, NE, NW, S, SE and SW

Any help is greatly appreciated.


Maybe you can adapt this: (also add err trapping)

Function Test(strValue As String) As String
Dim lngNum As Long 'Number part
Dim strOther As String 'Other part
strValue = Trim(strValue) 'remove spaces
lngNum = Val(strValue)
If lngNum > 0 Then 'we found the number part here
strOther = Trim(Mid(strVal ue, Len(lngNum) + 1))
End If
Select Case strOther
Case "N", "NE", "NW", "S", "SE", "SW"
Test = Trim(Left(strVa lue, Len(strValue) - Len(strOther))) & " -- " & strOther
Case Else
Test = strValue
End Select
End Function

Arno R

Apr 27 '06 #2
On 27 Apr 2006 09:56:11 -0700, Sm******@aol.co m wrote:
All,

I am not well versed in writing code and was looking for some
assistance.

I have the following info.

housenumber directional
1143
1142 N
1134 NE
1135 B

What I am trying to accomplish is the following:

housenumber directional
1143
1142 N
1134 NE
1135 B

This would only pertain to N, NE, NW, S, SE and SW

Any help is greatly appreciated.


What Access version?

How do you know that the "N" in 1142 N is not the apartment number,
rather than a directional?
What about E and W?
What about numbers like 1142 1/2 N

Back up your data first.

If your version supports the InStrRev() function,

Add a new Module to your database with these 2 functions:
NOTE: I've added "E" and "W" to the directions. If you don't want
them, don't include them below.

Function FindHouseNumber (FieldIn As String) As String
Dim strValue As String
Dim Var As Variant
strValue = Mid(FieldIn, InStrRev(FieldI n, " ") + 1)
Select Case strValue
Case "N", "NW", "E", "W", "S", "N", "NE", "SE", "SW"
FindHouseNumber = Left(FieldIn, InStrRev(FieldI n, " ") - 1)
Case Else
FindHouseNumber = FieldIn
End Select

End Function
=============== ===

Public Function FindDirectional (FieldIn As String)
Dim strValue As String
strValue = Mid(FieldIn, InStrRev(FieldI n, " ") + 1)
Select Case strValue
Case "N", "NW", "E", "W", "S", "N", "NE", "SE", "SW"
FindDirectional = strValue
Case Else
FindDirectional = Null
End Select

End Function
=============
To permanently split the data, create an Update query:

UPDATE TableName SET TableName.Direc tional =
FindDirectional ([HouseNumber]), TableName.House Number =
FindHouseNumber ([HouseNumber])
WHERE (((TableName.Ho useNumber) Is Not Null));

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Apr 27 '06 #3
Thanks Fred. It worked great.

Apr 28 '06 #4

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

Similar topics

12
55548
by: Sam Collett | last post by:
How do I remove an item with a specified value from an array? i.e. array values 1,2,2,5,7,12,15,21 remove 2 from array would return 1,5,7,12,15,21 (12 and 21 are NOT removed, duplicates are also removed) So far I have (val is value, ar is array, returns new array):
22
1748
by: fynali | last post by:
Hi all, I have two files: - PSP0000320.dat (quite a large list of mobile numbers), - CBR0000319.dat (a subset of the above, a list of barred bumbers) # head PSP0000320.dat CBR0000319.dat ==> PSP0000320.dat <== 96653696338
7
1688
by: a | last post by:
If the code to insert a new Student is: Profile.Teachers.Classes.Students.Add(new TCS.Student(id,teacher, class, name)); what is the code to Remove a student? I tried the code below, but I don't understand the syntax: Profile.Teachers.Classes.Students.Remove(new TCS.Student(name));// This line fails
3
2605
by: dazzle | last post by:
I have an XML file and I would like to remove duplicate nodes within it but I can't get my head round on how to do this. Example XML file: <root> <plugin> <title>A9</title> <url>some url</url>
9
2412
by: mistral | last post by:
Need help to remove list of days from date script. Need format "June 07, 2006" <SCRIPT LANGUAGE="JavaScript"> <!-- Begin // Get today's current date. var now = new Date();
3
1796
by: wolfing1 | last post by:
how would I go doing it without javascript and using 'POST'? Having a page with a variable list of items in a shopcart, each item with its own 'remove' button. How could I do this without a javascript and using POST as the form type? (so having <a href="page.htm?remove=2> is not possible)
4
9591
by: Yansky | last post by:
Got a quick n00b question. What's the difference between del and remove?
2
9078
by: =?Utf-8?B?R3JlZw==?= | last post by:
I have the following code the dynamically adds a specific number of controls. for x as integer = 1 to 10 Dim btn as Windows.Forms.Button = New Windows.Forms.Button btn.Name = "btn" & x btn.Text = "Test" & x controls.add(btn) next x This results in 10 buttons appearing on the screen. I've excluded the
6
4248
by: falconsx23 | last post by:
I am trying to write a code for a Phone Directory program. This program is suppose to allow the user to enter a name or directory and then program can either add, save or even delete an entry. Also this program has more then one class and also uses an interface. Right now I am working on ArrayBasedPD class. I am trying to write a code for the remove method (line 158) that allows the user to enter a name, once the program sees that the name is...
0
8428
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
8337
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
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8748
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...
0
7359
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...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
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.