Displaying only the FIRST TWO WORDS of a field

  • Thread starter Thread starter brba
  • Start date Start date
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.
 
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
 
Back
Top