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