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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hello .. I have a text column in

Status
Not open for further replies.

yesilkalem

IS-IT--Management
Aug 4, 2001
26
0
0
TR
hello ..
I have a text column in my table. This text is a explanation of accounting process. But our database administrator made a mistake. we dont have an account number column. instead, in explanation we have account-customer Id- number in text explanation. it always starts with 00158 or with 58939.. now my question is: how can i get 13 digit number which begins with these numbers..
which functions should I use?
thanks
 
Use this function:

Function GetAccountNumber(strText As String) As String
Dim i As Integer

'find position of first account number
i = InStr(strText, "00158")
'if not found look for second
If i = 0 Then i = InStr(strText, "58939")
'if still not found, it's not here!
If i = 0 Then Exit Function

GetAccountNumber = Mid(strText, i, 13)

End Function



Ben ----------------------------------
Ben O'Hara
bo104@westyorkshire.police.uk
----------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top