Mar 9, 2005 #1 Rachel30 Programmer Joined Mar 1, 2005 Messages 95 Location GB Hi, I have a field called status. in this field I could have string link:- New Amendments Only I only want the first word to show of the string ie:- New Amendments Any idea's how to write an expression for this. Thanks Rachel
Hi, I have a field called status. in this field I could have string link:- New Amendments Only I only want the first word to show of the string ie:- New Amendments Any idea's how to write an expression for this. Thanks Rachel
Mar 9, 2005 #2 S SkipVought Programmer Joined Dec 4, 2001 Messages 47,492 Location US Hi, Code: Left([Field], InStr([Field], " ")-1) Skip, [red]Be advised:[/red] The dyslexic, agnostic, insomniac, lays awake all night wondering... "Is there really a DOG?" Upvote 0 Downvote
Hi, Code: Left([Field], InStr([Field], " ")-1) Skip, [red]Be advised:[/red] The dyslexic, agnostic, insomniac, lays awake all night wondering... "Is there really a DOG?"
Mar 9, 2005 #3 grande Programmer Joined Feb 14, 2005 Messages 657 Location CA Put the string into a variable (strWord in this example). Then, use Code: If InStr(strWord, " ") > 0 Then strWord = Left(strWord, InStr(strWord, " ")) End If If you're doing this in a query, the code would be Code: IIf(InStr([FieldName], " ") > 0, Left([FieldName], InStr([FieldName], " ")), [FieldName]) ------------------------- Just call me Captain Awesome. Upvote 0 Downvote
Put the string into a variable (strWord in this example). Then, use Code: If InStr(strWord, " ") > 0 Then strWord = Left(strWord, InStr(strWord, " ")) End If If you're doing this in a query, the code would be Code: IIf(InStr([FieldName], " ") > 0, Left([FieldName], InStr([FieldName], " ")), [FieldName]) ------------------------- Just call me Captain Awesome.
Mar 9, 2005 Thread starter #4 Rachel30 Programmer Joined Mar 1, 2005 Messages 95 Location GB Thanks guys. Rachel Upvote 0 Downvote