Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have a field that is a descriptio

Status
Not open for further replies.

shrive22

MIS
Dec 8, 2003
8
US
I have a field that is a description of a property name ex "adams 162 fake st", "applewood 354 main st", "heartland 555 straight st", "beechwood 789 oneway ave" etc. the description field also has the address in it. I was wondering if it is possible to use a formula to get the first word in the field (which is the location) and then use that for a group??

thanks for the help
 
Is there any function that can extract just the first word out of a string???

thanks
 
Assuming that the first space is the end of the first word, then this works:

Mid ({Table.Field},1 , instr({Table.Field}," "))

You should be able to group on this without any trouble.

-dave
 
For use in a group try the following to allow for blanks:

if isnull({Table.Field})
or
instr({Table.Field}," ") = 0 then
"No spaces"
else
left({Table.Field},instr({Table.Field}," "))

-k
 
I used this formula

left({jobs.jobdescription},instr({jobs.jobdescription}
and it worked fine except for that there are a couple of records that in the desctiption the only thing that is in there is one word(the location). and with this formula it puts those records with just one word(the location) in the descption in there own group. I was wondering if theres a way to get them to be in the same group as the others
 
SV's formula should work for you. Here's a slight variation.

if
instr({jobs.jobdescription}," ") = 0 then
{jobs.jobdescription}
else
trim(left({jobs.jobdescription}instr({jobs.jobdescription}," ")))

-dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top