Help string Parse

  • Thread starter Thread starter Chris
  • Start date Start date
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
 
Hi, Chris,

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

Make sure to substitute your field name for CustInfo.

Sam
 
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]
 
Back
Top