Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search a string value for specific character and extract 1

Status
Not open for further replies.

Webkins

Programmer
Dec 11, 2008
118
US
Hello, I would like some help to figure out how to search the following string value for the first letter "B" and extract and store the next following digits "1234567". I am using Access 2003 and VBA.

2030AAEE09226XX1B1234567AB9623

Thank you for helping.
 
I forgot to mention that the number of characters up to the first letter "B" are variable. The first letter "B" is not always in the same position.

Thanks
 
A starting point:
Mid(yourField,1+InStr(yourField,"B"),7)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
How about

Public Function Find_B(strIN As String) As String
Dim intI As Integer

For intI = 1 To Len(strIN)
If UCase(Mid(strIN, intI, 1)) = "B" Then Exit For
Next intI

Find_B = Mid(strIN, intI + 1, 7)

End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top