473,385 Members | 1,409 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,385 software developers and data experts.

Editing text fields in Access 2000

Access 2000
I have a text field named RoadName that contains the total road name,
for
example, "Johnson Road". I have another text field named StreetName
that I would like to just contain the name portion of the RoadName, in
this case,
just "Johnson". Is there a way to either remove the Road portion from
text
strings in the RoadName field, so that I am just left with "Johnson"?
Or
even better, is there a way to automatically populate the new
StreetName
field with just the name portion of the original text string (just
"Johnson")? Thanks in advance.

Nov 13 '05 #1
2 1380
Try as the controlsource of StreetName

IIf(Instr(RoadName), " " > 0, Left(RoadName Instr(RoadName, " ")-1),
RoadName)
This looks for the first space in the RoadName and sets the Street name to
the left of RoadName how ever many letters there are before the first space.
If there is no space, you get the whole word.

I have my doubts that it will always work. You could change the " " to "
Road" if you want to.
Note the IIf is not a misprint

HTH

Phil
<JA********@CO.COLUMBIA.WI.US> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
Access 2000
I have a text field named RoadName that contains the total road name,
for
example, "Johnson Road". I have another text field named StreetName
that I would like to just contain the name portion of the RoadName, in
this case,
just "Johnson". Is there a way to either remove the Road portion from
text
strings in the RoadName field, so that I am just left with "Johnson"?
Or
even better, is there a way to automatically populate the new
StreetName
field with just the name portion of the original text string (just
"Johnson")? Thanks in advance.

Nov 13 '05 #2
Not perfectly accurately, but something like this (This is changed from
similar code I use, so it might not be exactly right):

Public Function ParseRoad(roadName As String)
Dim i As Integer
Dim s As String
Const strList = "street avenue boulevard drive road way court terrace
lane highway place"

s = Trim$(roadName)
i = InStrRev(s, " ")
If i > 0 Then
s1 = Mid$(s, i + 1)
If InStr(1, strList, s1, vbTextCompare) > 0 Then
ParseRoad = Mid$(s, i - 1)
Else
ParseRoad = s
End If
End Function

This ought to handle 99% of streets

--
Darryl Kerkeslager

Power corrupts.
Absolute power corrupts absolutely.
Knowledge is power.
See www.adcritic.com/interactive/view.php?id=5927

<JA********@CO.COLUMBIA.WI.US> wrote
I have a text field named RoadName that contains the total road name,
for
example, "Johnson Road". I have another text field named StreetName
that I would like to just contain the name portion of the RoadName, in
this case,
just "Johnson". Is there a way to either remove the Road portion from
text
strings in the RoadName field, so that I am just left with "Johnson"?
Or
even better, is there a way to automatically populate the new
StreetName
field with just the name portion of the original text string (just
"Johnson")? Thanks in advance.

Nov 13 '05 #3

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

Similar topics

5
by: Ryan | last post by:
I have some software (written in Delphi 5) which has been working for several months without a problem. I have been given a copy of the database on our development server (SQL 7) and have...
3
by: Oren | last post by:
Hi, I have an Access application with linked tables via ODBC to MSSQL server 2000. Having a weird problem, probably something i've done while not being aware of (kinda newbie). the last 20...
2
by: NewBob | last post by:
Since Access automatically highlights all of the text in a text control (I use it to hold data from a memo field) when the control is activated, I've added the following code to put the cursor at...
1
by: Serious_Practitioner | last post by:
Hello, all - I want to get a customer name, address and so forth from a customer table using either a SELECT statement in a VBA procedure or in a query. The user should be able to put a customer...
1
by: RC | last post by:
I have an Access 2002 database with many tables and forms (but just to keep things simple, let's say the DB has one Table "Table1" and one Form "Form1"). I have managed to cobble together so much...
4
by: Daniel Kaseman | last post by:
I want to make a program that has 3 textboxes for inputting: Name, ID, Amount, and then when I click "Add Item" button, it adds it to a text file, and shows up on the list box. When I close and...
1
by: Child of His | last post by:
I have been through every trick I know, or has been suggested. I have a one to two million line fixed field database in text format. I want to bring it into Access 97. When I use the external...
1
by: Wandering | last post by:
I know you guys are heavy duty coders, while I do ad-hoc analysis, and rarely write code. And, I may be in the wrong groups because this is about an install issue, and I don't think it's a code...
4
by: helenwheelss | last post by:
Access 2003, using a bound form. I'm seeing rather annoying behaviour when editing data in a control with a default value. It only happens when the form is on a new record. A specific...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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...

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.