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
 

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

Back
Top