I am Stumpted - Parsing Nightmare (1 Viewer)

Ricky

Registered User.
Local time
Today, 15:40
Joined
May 30, 2000
Messages
13
I have tried several ways to Parse this customer file. Its a bankers database that was sent to me tab delimited. In my name field I have names like:

FIELD1
SHIRLEY CAPUTO/IRA
FBO NORMAN E SCHULTZ JR
MARK RUDERMAN TTEE
LEE J MITCHELL


IRA FBO ELAINE M SCHRUTT
EDWARD WEINBERGER SP
IRA OF MICHAEL PERTESSIS
GERD M. GRACE

I need to get rid of all the junk txt like IRA, SP, OR, TTEE, and such. I also need to grab the first name and send it to another field same with last name. I had the idea to create a junk table with all the junk text to parse that out first. I need some assistance setting up the code to look at the junk table and compare it to my Name table. Then I can hopefully sort out my FNAME and LNAME- Can anyone shed some light, or point me to a better way to accomplish this? Thanks
 

ayeshamiah

Registered User.
Local time
Today, 15:40
Joined
May 24, 2000
Messages
20
Hi Ricky,

How far have you got so far

I have had a similar sort of nightmare, I have some code which may be of some use to you but you will have to amend it I used the following to convert this ",1,19,24,29" to individual integers and fill an array.

I got the code from a book if it helps I'll email you an attachment, Kind regards, Ayesha

here goes

Function testextract(strInitext As String)
Dim intI As Integer
Dim strText As Integer
'Dim strInitext As String
intI = 2
Do While True
strText = dhExtractString(strInitext, intI, ",")
If Len(strText) = 0 Then
Exit Do
End If
MsgBox strText
intI = intI + 1
Loop
End Function
Function dhExtractString(ByVal strIn As String, ByVal intPiece As Integer, Optional ByVal strDelimiter As String) As String
Dim intPos As Integer
Dim intLastPos As Integer
Dim intLoop As Integer
Dim intPos1 As Integer

intPos = 0
intLastPos = 0
intLoop = intPiece

' If there's more than one delimiter, map them
' all to the first one.
'If Len(strDelimiter) > 1 Then
' strIn = dhTranslate(strIn, strDelimiter, Left$(strDelimiter, 1))
'End If

Do While intLoop > 0
intLastPos = intPos
intPos1 = InStr(intPos + 1, strIn, Left$(strDelimiter, 1))
If intPos1 > 0 Then
intPos = intPos1
intLoop = intLoop - 1
Else
intPos = Len(strIn) + 1
Exit Do
End If
Loop
' If the string wasn't found, and this wasn't
' the first pass through (intLoop would equal intPiece
' in that case) and intLoop > 1, then you've run
' out of chunks before you've found the chunk you
' want. That is, the chunk number was too large.
' Return "" in that case.
If (intPos1 = 0) And (intLoop <> intPiece) And (intLoop > 1) Then
dhExtractString = ""
Else
dhExtractString = Mid$(strIn, intLastPos + 1, _
intPos - intLastPos - 1)
End If
End Function
 

Ricky

Registered User.
Local time
Today, 15:40
Joined
May 30, 2000
Messages
13
Thanks, I believe I am on the right track- Thanks again for the code.
 

Users who are viewing this thread

Top Bottom