Returning part of a field value in code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can anybody help

I have a text field use to store both names and towns. It has been inputted
into the table using this format

Name (Town)

Is it possible in code to return the name only ie everything before the
bracket.
For example if the text field contained

Taylor (Manchester)

I want the Taylor part only

Thanks In advance

Matt
 
Matt,
try this
Left(yourtext, InStr(1, yourtext, " (") - 1)

Note, however that it will blow up if there is no space-opening parentecis
sequence in yourtext. If there is such possibility, check for this condition
before running this code
 
Back
Top