Help string Parse

C

Chris

The company I work for has a customer table and in the customer name filed
they have the customer name along with the store number. Example: "central
pipe #123" or "central pipe #12345". I would like to grab just the store
number so I need to know how to search the string for the number sign and
grab everything that follows it. Can anyone help me?

thanks,
Chris
 
O

OfficeDev18 via AccessMonster.com

Hi, Chris,

Try this: StoreNo = Right(CustInfo,Len(CustInfo)-InStr(CustInfo,"#"))

Make sure to substitute your field name for CustInfo.

Sam
 
J

John Vinson

The company I work for has a customer table and in the customer name filed
they have the customer name along with the store number. Example: "central
pipe #123" or "central pipe #12345". I would like to grab just the store
number so I need to know how to search the string for the number sign and
grab everything that follows it. Can anyone help me?

thanks,
Chris

A slightly simpler syntax than that suggested by Sam depends on the
fact that the Mid() function's third argument (the length of the
returned string) is optional - if you leave it off it returns the rest
of the string:

Mid([CustomerName], InStr([CustomerName], "#"))

will return #123 or #12345 respectively.

John W. Vinson[MVP]
 

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