Displaying only the FIRST TWO WORDS of a field

B

brba

I am writing a report that could get quite lengthy. Therefore, instead of
displaying the entire description in a report, is there anyway of displaying
just the first two words of the description.

The format of the description field is "XXX <WordOfAnyLength>" where XXX is
a fixed length of 3 characters, followed by a space. The next word can be
any length. I would like to display the first two words in their entirety.

Thanks.
 
J

John Spencer

Try this expression in the query
Field: TwoWords: LEFT([Description],Instr(5,[Description] & " "," "))

Short explanation:
Instr will start looking for a space at the fifth character. Concatenating a
space on the end of Description just ensures that if you had a description
like "xxx Oneword" that the data would be returned and not a zero-length string.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top