When I run my script it gives error on the following line:
strEmail = Right(strEmail, (Len(strEmail) - 1))
I enclose my code and the sample text file too
Thanks,
-----------------------------------------------------------------------------
Option Compare Database
Option Explicit
Private Sub Command26_Click ()
DoCmd.Close
End Sub
Private Sub cmdParse_Click( )
DoCmd.SetWarnin gs False
Dim strfile As String
Dim AcctNum As String
AcctNum = "Account Number"
'Box
Credits----------------------------------------------------------------------------
'-----------------------------------------------------------------------------------
ChDir ("C:\MailSave\R equests\")
strfile = Dir("C:\MailSav e\Requests\200" & "*.*")
Do While Len(strfile) 0
FileCopy "C:\MailSave\Re quests\" & strfile,
"C:\MailSave\Ge tInfo.txt"
Dim fileName As String
Dim stemp, linesfromfile, nextline As String
Dim iFIle As Integer
iFIle = FreeFile
Open "C:\MailSave\Re quests\" & strfile For Input As iFIle
While Not EOF(1)
Line Input #1, nextline
linesfromfile = linesfromfile + nextline + Chr(13) + Chr(10)
Wend
Close iFIle
Call TestReplace
Me.txtEmail.Val ue = linesfromfile
Kill "C:\MailSave\Re quests\" & strfile
strfile = Dir("C:\MailSav e\Requests\200" & "*.*")
linesfromfile = ""
Dim strEmail As String
Dim bSummaryFound As Boolean
Dim bServicesFound As Boolean
Dim strVerifyBox As String
Dim bMonthlyRateFou nd As Boolean
Dim bRequestTypeFou nd As Boolean
Dim strServices As String
Dim bLanguageFound As Boolean
Dim bLastEventDateF ound As Boolean
Dim strMonthlyRate As String
Dim bPPVHoldFound As Boolean
Dim strLastEventDat e As String
Dim bMDPageIDFound As Boolean
Dim strInstallDate As String
Dim strLanguage As String
Dim bInstallDateFou nd As Boolean
Dim bNameFound As Boolean
Dim strEventNumDate Range As String
Dim bAddressFound As Boolean
Dim bCityStateZipFo und As Boolean
Dim bVerifyBoxFound As Boolean
Dim bSubjectFound As Boolean
Dim strMDPageID As String
Dim bReturnMethodFo und As Boolean
Dim bAccountNumFoun d As Boolean
Dim bReturnDateFoun d As Boolean
Dim strCRCPIN As String
Dim bCommentsFound As Boolean
Dim bBoxTypeFound As Boolean
Dim strRequestType As String
Dim bBoxQtyFound As Boolean
Dim bCreditAmountFo und As Boolean
Dim bConvertersFoun d As Boolean
Dim bSenderFound As Boolean
Dim bRequestDateFou nd As Boolean
Dim strStringBefore As String
Dim strName As String
Dim strAddress As String
Dim strCityStateZip As String
Dim strSubject As String
Dim strReturnMethod As String
Dim strAccountNum As String
Dim strCurrentChar As String
Dim strReturnDate As String
Dim strComments As String
Dim strBoxType As String
Dim strBoxQty As String
Dim strCreditAmount As String
Dim strConverterNum bers As String
Dim strSender As String
Dim strRequestDate As String
Dim lngLengthOfEmai l As Long
Dim bEventNumDateRa ngeFound As Boolean
Dim lngCharPointer1 As Long
Dim lngCharPointer2 As Long
Dim dbDatabase As DAO.Database
Dim rsRecordset As DAO.Recordset
Dim bCRCPINFound As Boolean
Dim strPPVHold As String
Dim strSummary As String
If (IsNull(Me.txtE mail.Value)) Then
MsgBox "[Email] field is blank. Please try again.",
vbExclamation + vbOKOnly
Me.txtEmail.Set Focus
Exit Sub
End If
Me.txtStatusBar .Value = "Parsing... "
strEmail = Me.txtEmail.Val ue
' Initialize
bNameFound = False
bAddressFound = False
bCityStateZipFo und = False
bSubjectFound = False
bReturnMethodFo und = False
bAccountNumFoun d = False
bCommentsFound = False
bBoxQtyFound = False
bBoxTypeFound = False
bCreditAmountFo und = False
bConvertersFoun d = False
bReturnDateFoun d = False
bSenderFound = False
bRequestDateFou nd = False
strRequestDate = ""
strName = ""
strAddress = ""
strCityStateZip = ""
strSubject = ""
strReturnMethod = ""
strAccountNum = ""
strStringBefore = ""
strComments = ""
strBoxQty = ""
strBoxType = ""
strCreditAmount = ""
strConverterNum bers = ""
strReturnDate = ""
strSender = ""
lngLengthOfEmai l = Len(strEmail)
lngCharPointer1 = 0
Do While (Not bSubjectFound)
strCurrentChar = Left(strEmail, 1)
If (strCurrentChar = ":") Then
'Novell
ID--------------------------------------------------------------
If (InStr(strStrin gBefore, "Date")) Then
If (Not bRequestDateFou nd) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <vbCr)
strRequestDate = strRequestDate & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bRequestDateFou nd = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Subject-----------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "ubject")) Then
If (Not bSubjectFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save subject until crlf
Do While (strCurrentChar <"[")
strSubject = strSubject & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bSubjectFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
Else
' Reset string before ':' and move to the next character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
Else
' Append this character to string that is before ':'
strStringBefore = strStringBefore & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
' ' Advance the character pointer
lngCharPointer1 = lngCharPointer1 + 1
Loop
Do While (Not bMDPageIDFound)
strCurrentChar = Left(strEmail, 1)
If (strCurrentChar = "]") Then
'Novell
ID--------------------------------------------------------------
If (InStr(strStrin gBefore, "ovell ID")) Then
If (Not bSenderFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strSender = strSender & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bSenderFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
' Else
' ' Reset string before ':' and move to the next character
' strStringBefore = ""
' strEmail = Right(strEmail, (Len(strEmail) - 1))
' End If
' Else
' ' Append this character to string that is before ':'
' strStringBefore = strStringBefore & strCurrentChar
' ' Move to the next character
' strEmail = Right(strEmail, (Len(strEmail) - 1))
' End If
' ' Advance the character pointer
' lngCharPointer1 = lngCharPointer1 + 1
'Loop
' Do While ((lngCharPointe r1 <= lngLengthOfEmai l))
'And (Not bSummaryFound))
' strCurrentChar = Left(strEmail, 1)
' If (strCurrentChar = "]") Then
'Name--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "s Name")) Then
If (Not bNameFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save name until cr
Do While (strCurrentChar <"[")
strName = strName & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bNameFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Return
Date--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "Date of Return")) Then
If (Not bReturnDateFoun d) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strReturnDate = strReturnDate & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bReturnDateFoun d = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Return
Method--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "Return Method")) Then
If (Not bReturnMethodFo und) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strReturnMethod = strReturnMethod & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bReturnMethodFo und = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Address-------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "treet")) Then
If (Not bAddressFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strAddress = strAddress & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bAddressFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'City, State,
Zip--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "Zip")) Then
If (Not bCityStateZipFo und) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strCityStateZip = strCityStateZip & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bCityStateZipFo und = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Account Number-------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "count Number")) Then
If (Not bAccountNumFoun d) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strAccountNum = strAccountNum & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bAccountNumFoun d = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Install Date--------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "stall Date")) Then
If (Not bInstallDateFou nd) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strInstallDate = strInstallDate & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bInstallDateFou nd = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Last Known Event
Date-------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "Known Event Date")) Then
If (Not bLastEventDateF ound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strLastEventDat e = strLastEventDat e &
strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bLastEventDateF ound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'PPV Hold--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "PV Hold")) Then
If (Not bPPVHoldFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strPPVHold = strPPVHold & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bPPVHoldFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Monthly
Rate--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "onthly Rate")) Then
If (Not bMonthlyRateFou nd) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strMonthlyRate = strMonthlyRate & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bMonthlyRateFou nd = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Current
Services--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "urrent Services")) Then
If (Not bServicesFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strServices = strServices & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bServicesFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Request
Type--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "ype of Request")) Then
If (Not bRequestTypeFou nd) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strRequestType = strRequestType & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bRequestTypeFou nd = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Language------------------------------------
ElseIf (InStr(strStrin gBefore, "anguage")) Then
If (Not bLanguageFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strLanguage = strLanguage & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bLanguageFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'CRC Pin Instructions-------------------------------------------------
ElseIf (InStr(strStrin gBefore, "Pin Instructions")) Then
If (Not bCRCPINFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strCRCPIN = strCRCPIN & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bCRCPINFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Event Numbers/Date Range-----------------------
ElseIf (InStr(strStrin gBefore, "Date Range")) Then
If (Not bEventNumDateRa ngeFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strEventNumDate Range = strEventNumDate Range &
strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bEventNumDateRa ngeFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Summary----------------------------------------
ElseIf (InStr(strStrin gBefore, "ummary")) Then
If (Not bSummaryFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strSummary = strSummary & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bSummaryFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'BoxType--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "Type Of Box")) Then
If (Not bBoxTypeFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strBoxType = strBoxType & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bBoxTypeFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'BoxQty--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "How Many Boxes")) Then
If (Not bBoxQtyFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strBoxQty = strBoxQty & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bBoxQtyFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'CreditAmount--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "Amount To Credit")) Then
If (Not bCreditAmountFo und) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strCreditAmount = strCreditAmount & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bCreditAmountFo und = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'ConverterNumbe rs--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "ConverterNumbe rs")) Then
If (Not bConvertersFoun d) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strConverterNum bers = strConverterNum bers &
strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bConvertersFoun d = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Comments--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "Comments") ) Then
If (Not bCommentsFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strComments = strComments & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bCommentsFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Box Verification-------------------------------
ElseIf (InStr(strStrin gBefore, "Verificati on by Customer"))
Then
If (Not bVerifyBoxFound ) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strVerifyBox = strVerifyBox & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bVerifyBoxFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'MD Page
ID--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "Page ID")) Then
If (Not bMDPageIDFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save city, state, zip until cr
Do While (strCurrentChar <"[")
strMDPageID = strMDPageID & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bMDPageIDFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'--------------------------------------------------------------------------------
End If
End If
' Else
' Append this character to string that is before ':'
strStringBefore = strStringBefore & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
'I COMPARE THESE LINES------------------------------
' Advance the character pointer
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Clear white space, from right
If (bNameFound) Then
strCurrentChar = Right(strName, 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strName = Left(strName, (Len(strName) - 1))
strCurrentChar = Right(strName, 1)
Loop
End If
If (bSenderFound) Then
strCurrentChar = Right(strSender , 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strSender = Left(strSender, (Len(strSender) - 1))
strCurrentChar = Right(strSender , 1)
Loop
End If
If (bSubjectFound) Then
strCurrentChar = Right(strSubjec t, 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strSubject = Left(strSubject , (Len(strSubject ) - 1))
strCurrentChar = Right(strSubjec t, 1)
Loop
End If
If (bReturnMethodF ound) Then
strCurrentChar = Right(strReturn Method, 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strReturnMethod = Left(strReturnM ethod, (Len(strReturnM ethod) -
1))
strCurrentChar = Right(strReturn Method, 1)
Loop
End If
If (bAccountNumFou nd) Then
strCurrentChar = Right(strAccoun tNum, 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strAccountNum = Left(strAccount Num, (Len(strAccount Num) - 1))
strCurrentChar = Right(strAccoun tNum, 1)
Loop
End If
If (bAddressFound) Then
strCurrentChar = Right(strAddres s, 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strAddress = Left(strAddress , (Len(strAddress ) - 1))
strCurrentChar = Right(strAddres s, 1)
Loop
End If
If (bCityStateZipF ound) Then
strCurrentChar = Right(strCitySt ateZip, 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strCityStateZip = Left(strCitySta teZip, (Len(strCitySta teZip) -
1))
strCurrentChar = Right(strCitySt ateZip, 1)
Loop
End If
If (bReturnDateFou nd) Then
strCurrentChar = Right(strReturn Date, 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strReturnDate = Left(strReturnD ate, (Len(strReturnD ate) - 1))
strCurrentChar = Right(strReturn Date, 1)
Loop
End If
If (bBoxTypeFound) Then
strCurrentChar = Right(strReturn Date, 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strReturnDate = Left(strReturnD ate, (Len(strReturnD ate) - 1))
strCurrentChar = Right(strReturn Date, 1)
Loop
End If
If (bBoxQtyFound) Then
strCurrentChar = Right(strReturn Date, 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strReturnDate = Left(strReturnD ate, (Len(strReturnD ate) - 1))
strCurrentChar = Right(strReturn Date, 1)
Loop
End If
If (bCreditAmountF ound) Then
strCurrentChar = Right(strReturn Date, 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strReturnDate = Left(strReturnD ate, (Len(strReturnD ate) - 1))
strCurrentChar = Right(strReturn Date, 1)
Loop
End If
If (bCommentsFound ) Then
strCurrentChar = Right(strCommen ts, 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strComments = Left(strComment s, (Len(strComment s) - 1))
strCurrentChar = Right(strCommen ts, 1)
Loop
End If
Me.txtStatusBar .Value = "Parsing...Comp lete."
'Debug.Print _
' "Name Found: " & bNameFound & vbCrLf & _
' "Name: " & strName & vbCrLf & vbCrLf & _
' "Address Found: " & bAddressFound & vbCrLf & _
' "Address: " & strAddress & vbCrLf & vbCrLf & _
' "City, State, Zip Found: " & bCityStateZipFo und & vbCrLf & _
' "City, State, Zip: " & strCityStateZip
If (bNameFound And bAddressFound And bCityStateZipFo und And
bSubjectFound And bAccountNumFoun d) Then
Me.txtStatusBar .Value = "Creating record..."
' Found all the fields
Set dbDatabase = CurrentDb()
Set rsRecordset = dbDatabase.Open Recordset("tblC ustomers")
' Create a new record with parsed info
rsRecordset.Add New
rsRecordset.Fie lds(1).Value = UCase(strReques tDate)
rsRecordset.Fie lds(2).Value = UCase(strName)
rsRecordset.Fie lds(3).Value = UCase(strSender )
rsRecordset.Fie lds(4).Value = UCase(strAddres s)
rsRecordset.Fie lds(5).Value = UCase(strCitySt ateZip)
' rsRecordset.Fie lds(6).Value = UCase(strSubjec t)
rsRecordset.Fie lds(7).Value = UCase(strReturn Method)
rsRecordset.Fie lds(8).Value = UCase(strAccoun tNum)
rsRecordset.Fie lds(9).Value = UCase(strReturn Date)
rsRecordset.Fie lds(10).Value = UCase(strBoxTyp e)
rsRecordset.Fie lds(11).Value = UCase(strBoxQty )
rsRecordset.Fie lds(12).Value = UCase(strCredit Amount)
rsRecordset.Fie lds(13).Value = UCase(strConver terNumbers)
rsRecordset.Fie lds(14).Value = UCase(strCommen ts)
rsRecordset.Upd ate
rsRecordset.Clo se
Set rsRecordset = Nothing
dbDatabase.Clos e
Set dbDatabase = Nothing
Else
'Could not find all or some of the fields
'Add incomplete record to exceptions table for manual processing.
Set dbDatabase = CurrentDb()
Set rsRecordset = dbDatabase.Open Recordset("tblE xceptions")
rsRecordset.Add New
rsRecordset.Fie lds(1).Value = Me.txtEmail.Val ue
rsRecordset.Fie lds(2).Value = Now()
rsRecordset.Upd ate
rsRecordset.Clo se
Set rsRecordset = Nothing
dbDatabase.Clos e
Set dbDatabase = Nothing
'MsgBox "Could not find a field. Please try again.", vbExclamation
+ vbOKOnly
End If
' Clear email field and get ready for another one
Me.txtEmail.Val ue = Null
Me.txtEmail.Set Focus
Kill "C:\MailSave\Ge tInfo.txt"
Loop
DoCmd.SetWarnin gs False
DoCmd.OpenQuery "qry_LoadWo rk", acViewNormal, acEdit
DoCmd.OpenQuery "qry_UpdateBCSu bject", acViewNormal, acEdit
DoCmd.OpenQuery "qry_UpdateCRSu bject", acViewNormal, acEdit
DoCmd.OpenQuery "qry_DeletePars ed", acViewNormal, acEdit
Me.txtStatusBar .Value = "Creating record...Comple te."
Exit_cmdParse_C lick:
Exit Sub
End Sub
---------------------------------------------------------------------------------SAMPLE
TEXT FILE
Date: 2006-08-10-13-38-47
To: Stephen_Ng
From: <KDB Shared Services>
Subject: Box Credit - 501756
[Date]
Thu Aug 10 13:38:45 EDT 2006
[Novell ID]
SNG
[Subject]
Box Credit - 501756
[Customer's Name]
DIOMARIS GRULLON
[Street]
69 STUYVESANT AV APT 3
[City, State, Zip]
BROOKLYN NY, 11221
[Account Number]
07836-105575-02
[Corp]
7836
[Amount to Credit]
123
[Return Method]
Tech
[Tech Number]
123
[Date Returned]
08/10/2006
[Type of Equipment]
Digital
[Number of Boxes]
1
[Converter Numbers]
123
[Comments]
test
[Control Number]
658006
strEmail = Right(strEmail, (Len(strEmail) - 1))
I enclose my code and the sample text file too
Thanks,
-----------------------------------------------------------------------------
Option Compare Database
Option Explicit
Private Sub Command26_Click ()
DoCmd.Close
End Sub
Private Sub cmdParse_Click( )
DoCmd.SetWarnin gs False
Dim strfile As String
Dim AcctNum As String
AcctNum = "Account Number"
'Box
Credits----------------------------------------------------------------------------
'-----------------------------------------------------------------------------------
ChDir ("C:\MailSave\R equests\")
strfile = Dir("C:\MailSav e\Requests\200" & "*.*")
Do While Len(strfile) 0
FileCopy "C:\MailSave\Re quests\" & strfile,
"C:\MailSave\Ge tInfo.txt"
Dim fileName As String
Dim stemp, linesfromfile, nextline As String
Dim iFIle As Integer
iFIle = FreeFile
Open "C:\MailSave\Re quests\" & strfile For Input As iFIle
While Not EOF(1)
Line Input #1, nextline
linesfromfile = linesfromfile + nextline + Chr(13) + Chr(10)
Wend
Close iFIle
Call TestReplace
Me.txtEmail.Val ue = linesfromfile
Kill "C:\MailSave\Re quests\" & strfile
strfile = Dir("C:\MailSav e\Requests\200" & "*.*")
linesfromfile = ""
Dim strEmail As String
Dim bSummaryFound As Boolean
Dim bServicesFound As Boolean
Dim strVerifyBox As String
Dim bMonthlyRateFou nd As Boolean
Dim bRequestTypeFou nd As Boolean
Dim strServices As String
Dim bLanguageFound As Boolean
Dim bLastEventDateF ound As Boolean
Dim strMonthlyRate As String
Dim bPPVHoldFound As Boolean
Dim strLastEventDat e As String
Dim bMDPageIDFound As Boolean
Dim strInstallDate As String
Dim strLanguage As String
Dim bInstallDateFou nd As Boolean
Dim bNameFound As Boolean
Dim strEventNumDate Range As String
Dim bAddressFound As Boolean
Dim bCityStateZipFo und As Boolean
Dim bVerifyBoxFound As Boolean
Dim bSubjectFound As Boolean
Dim strMDPageID As String
Dim bReturnMethodFo und As Boolean
Dim bAccountNumFoun d As Boolean
Dim bReturnDateFoun d As Boolean
Dim strCRCPIN As String
Dim bCommentsFound As Boolean
Dim bBoxTypeFound As Boolean
Dim strRequestType As String
Dim bBoxQtyFound As Boolean
Dim bCreditAmountFo und As Boolean
Dim bConvertersFoun d As Boolean
Dim bSenderFound As Boolean
Dim bRequestDateFou nd As Boolean
Dim strStringBefore As String
Dim strName As String
Dim strAddress As String
Dim strCityStateZip As String
Dim strSubject As String
Dim strReturnMethod As String
Dim strAccountNum As String
Dim strCurrentChar As String
Dim strReturnDate As String
Dim strComments As String
Dim strBoxType As String
Dim strBoxQty As String
Dim strCreditAmount As String
Dim strConverterNum bers As String
Dim strSender As String
Dim strRequestDate As String
Dim lngLengthOfEmai l As Long
Dim bEventNumDateRa ngeFound As Boolean
Dim lngCharPointer1 As Long
Dim lngCharPointer2 As Long
Dim dbDatabase As DAO.Database
Dim rsRecordset As DAO.Recordset
Dim bCRCPINFound As Boolean
Dim strPPVHold As String
Dim strSummary As String
If (IsNull(Me.txtE mail.Value)) Then
MsgBox "[Email] field is blank. Please try again.",
vbExclamation + vbOKOnly
Me.txtEmail.Set Focus
Exit Sub
End If
Me.txtStatusBar .Value = "Parsing... "
strEmail = Me.txtEmail.Val ue
' Initialize
bNameFound = False
bAddressFound = False
bCityStateZipFo und = False
bSubjectFound = False
bReturnMethodFo und = False
bAccountNumFoun d = False
bCommentsFound = False
bBoxQtyFound = False
bBoxTypeFound = False
bCreditAmountFo und = False
bConvertersFoun d = False
bReturnDateFoun d = False
bSenderFound = False
bRequestDateFou nd = False
strRequestDate = ""
strName = ""
strAddress = ""
strCityStateZip = ""
strSubject = ""
strReturnMethod = ""
strAccountNum = ""
strStringBefore = ""
strComments = ""
strBoxQty = ""
strBoxType = ""
strCreditAmount = ""
strConverterNum bers = ""
strReturnDate = ""
strSender = ""
lngLengthOfEmai l = Len(strEmail)
lngCharPointer1 = 0
Do While (Not bSubjectFound)
strCurrentChar = Left(strEmail, 1)
If (strCurrentChar = ":") Then
'Novell
ID--------------------------------------------------------------
If (InStr(strStrin gBefore, "Date")) Then
If (Not bRequestDateFou nd) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <vbCr)
strRequestDate = strRequestDate & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bRequestDateFou nd = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Subject-----------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "ubject")) Then
If (Not bSubjectFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save subject until crlf
Do While (strCurrentChar <"[")
strSubject = strSubject & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bSubjectFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
Else
' Reset string before ':' and move to the next character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
Else
' Append this character to string that is before ':'
strStringBefore = strStringBefore & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
' ' Advance the character pointer
lngCharPointer1 = lngCharPointer1 + 1
Loop
Do While (Not bMDPageIDFound)
strCurrentChar = Left(strEmail, 1)
If (strCurrentChar = "]") Then
'Novell
ID--------------------------------------------------------------
If (InStr(strStrin gBefore, "ovell ID")) Then
If (Not bSenderFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strSender = strSender & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bSenderFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
' Else
' ' Reset string before ':' and move to the next character
' strStringBefore = ""
' strEmail = Right(strEmail, (Len(strEmail) - 1))
' End If
' Else
' ' Append this character to string that is before ':'
' strStringBefore = strStringBefore & strCurrentChar
' ' Move to the next character
' strEmail = Right(strEmail, (Len(strEmail) - 1))
' End If
' ' Advance the character pointer
' lngCharPointer1 = lngCharPointer1 + 1
'Loop
' Do While ((lngCharPointe r1 <= lngLengthOfEmai l))
'And (Not bSummaryFound))
' strCurrentChar = Left(strEmail, 1)
' If (strCurrentChar = "]") Then
'Name--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "s Name")) Then
If (Not bNameFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save name until cr
Do While (strCurrentChar <"[")
strName = strName & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bNameFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Return
Date--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "Date of Return")) Then
If (Not bReturnDateFoun d) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strReturnDate = strReturnDate & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bReturnDateFoun d = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Return
Method--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "Return Method")) Then
If (Not bReturnMethodFo und) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strReturnMethod = strReturnMethod & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bReturnMethodFo und = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Address-------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "treet")) Then
If (Not bAddressFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strAddress = strAddress & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bAddressFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'City, State,
Zip--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "Zip")) Then
If (Not bCityStateZipFo und) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strCityStateZip = strCityStateZip & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bCityStateZipFo und = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Account Number-------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "count Number")) Then
If (Not bAccountNumFoun d) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strAccountNum = strAccountNum & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bAccountNumFoun d = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Install Date--------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "stall Date")) Then
If (Not bInstallDateFou nd) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strInstallDate = strInstallDate & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bInstallDateFou nd = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Last Known Event
Date-------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "Known Event Date")) Then
If (Not bLastEventDateF ound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strLastEventDat e = strLastEventDat e &
strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bLastEventDateF ound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'PPV Hold--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "PV Hold")) Then
If (Not bPPVHoldFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strPPVHold = strPPVHold & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bPPVHoldFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Monthly
Rate--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "onthly Rate")) Then
If (Not bMonthlyRateFou nd) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strMonthlyRate = strMonthlyRate & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bMonthlyRateFou nd = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Current
Services--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "urrent Services")) Then
If (Not bServicesFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strServices = strServices & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bServicesFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Request
Type--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "ype of Request")) Then
If (Not bRequestTypeFou nd) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strRequestType = strRequestType & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bRequestTypeFou nd = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Language------------------------------------
ElseIf (InStr(strStrin gBefore, "anguage")) Then
If (Not bLanguageFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strLanguage = strLanguage & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bLanguageFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'CRC Pin Instructions-------------------------------------------------
ElseIf (InStr(strStrin gBefore, "Pin Instructions")) Then
If (Not bCRCPINFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strCRCPIN = strCRCPIN & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bCRCPINFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Event Numbers/Date Range-----------------------
ElseIf (InStr(strStrin gBefore, "Date Range")) Then
If (Not bEventNumDateRa ngeFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strEventNumDate Range = strEventNumDate Range &
strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bEventNumDateRa ngeFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Summary----------------------------------------
ElseIf (InStr(strStrin gBefore, "ummary")) Then
If (Not bSummaryFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strSummary = strSummary & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bSummaryFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'BoxType--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "Type Of Box")) Then
If (Not bBoxTypeFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strBoxType = strBoxType & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bBoxTypeFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'BoxQty--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "How Many Boxes")) Then
If (Not bBoxQtyFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strBoxQty = strBoxQty & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bBoxQtyFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'CreditAmount--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "Amount To Credit")) Then
If (Not bCreditAmountFo und) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strCreditAmount = strCreditAmount & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bCreditAmountFo und = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'ConverterNumbe rs--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "ConverterNumbe rs")) Then
If (Not bConvertersFoun d) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strConverterNum bers = strConverterNum bers &
strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bConvertersFoun d = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Comments--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "Comments") ) Then
If (Not bCommentsFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strComments = strComments & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bCommentsFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'Box Verification-------------------------------
ElseIf (InStr(strStrin gBefore, "Verificati on by Customer"))
Then
If (Not bVerifyBoxFound ) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save address until cr
Do While (strCurrentChar <"[")
strVerifyBox = strVerifyBox & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bVerifyBoxFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'MD Page
ID--------------------------------------------------------------
ElseIf (InStr(strStrin gBefore, "Page ID")) Then
If (Not bMDPageIDFound) Then
' Get rid of front white space
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Do While (strCurrentChar = " ")
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Save city, state, zip until cr
Do While (strCurrentChar <"[")
strMDPageID = strMDPageID & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
strCurrentChar = Left(strEmail, 1)
lngCharPointer1 = lngCharPointer1 + 1
Loop
bMDPageIDFound = True
' Reset string before ':' and move to the next
character
strStringBefore = ""
strEmail = Right(strEmail, (Len(strEmail) - 1))
End If
'--------------------------------------------------------------------------------
End If
End If
' Else
' Append this character to string that is before ':'
strStringBefore = strStringBefore & strCurrentChar
' Move to the next character
strEmail = Right(strEmail, (Len(strEmail) - 1))
'I COMPARE THESE LINES------------------------------
' Advance the character pointer
lngCharPointer1 = lngCharPointer1 + 1
Loop
' Clear white space, from right
If (bNameFound) Then
strCurrentChar = Right(strName, 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strName = Left(strName, (Len(strName) - 1))
strCurrentChar = Right(strName, 1)
Loop
End If
If (bSenderFound) Then
strCurrentChar = Right(strSender , 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strSender = Left(strSender, (Len(strSender) - 1))
strCurrentChar = Right(strSender , 1)
Loop
End If
If (bSubjectFound) Then
strCurrentChar = Right(strSubjec t, 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strSubject = Left(strSubject , (Len(strSubject ) - 1))
strCurrentChar = Right(strSubjec t, 1)
Loop
End If
If (bReturnMethodF ound) Then
strCurrentChar = Right(strReturn Method, 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strReturnMethod = Left(strReturnM ethod, (Len(strReturnM ethod) -
1))
strCurrentChar = Right(strReturn Method, 1)
Loop
End If
If (bAccountNumFou nd) Then
strCurrentChar = Right(strAccoun tNum, 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strAccountNum = Left(strAccount Num, (Len(strAccount Num) - 1))
strCurrentChar = Right(strAccoun tNum, 1)
Loop
End If
If (bAddressFound) Then
strCurrentChar = Right(strAddres s, 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strAddress = Left(strAddress , (Len(strAddress ) - 1))
strCurrentChar = Right(strAddres s, 1)
Loop
End If
If (bCityStateZipF ound) Then
strCurrentChar = Right(strCitySt ateZip, 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strCityStateZip = Left(strCitySta teZip, (Len(strCitySta teZip) -
1))
strCurrentChar = Right(strCitySt ateZip, 1)
Loop
End If
If (bReturnDateFou nd) Then
strCurrentChar = Right(strReturn Date, 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strReturnDate = Left(strReturnD ate, (Len(strReturnD ate) - 1))
strCurrentChar = Right(strReturn Date, 1)
Loop
End If
If (bBoxTypeFound) Then
strCurrentChar = Right(strReturn Date, 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strReturnDate = Left(strReturnD ate, (Len(strReturnD ate) - 1))
strCurrentChar = Right(strReturn Date, 1)
Loop
End If
If (bBoxQtyFound) Then
strCurrentChar = Right(strReturn Date, 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strReturnDate = Left(strReturnD ate, (Len(strReturnD ate) - 1))
strCurrentChar = Right(strReturn Date, 1)
Loop
End If
If (bCreditAmountF ound) Then
strCurrentChar = Right(strReturn Date, 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strReturnDate = Left(strReturnD ate, (Len(strReturnD ate) - 1))
strCurrentChar = Right(strReturn Date, 1)
Loop
End If
If (bCommentsFound ) Then
strCurrentChar = Right(strCommen ts, 1)
Do While (strCurrentChar = " ")
' Advance 1 char, from right
strComments = Left(strComment s, (Len(strComment s) - 1))
strCurrentChar = Right(strCommen ts, 1)
Loop
End If
Me.txtStatusBar .Value = "Parsing...Comp lete."
'Debug.Print _
' "Name Found: " & bNameFound & vbCrLf & _
' "Name: " & strName & vbCrLf & vbCrLf & _
' "Address Found: " & bAddressFound & vbCrLf & _
' "Address: " & strAddress & vbCrLf & vbCrLf & _
' "City, State, Zip Found: " & bCityStateZipFo und & vbCrLf & _
' "City, State, Zip: " & strCityStateZip
If (bNameFound And bAddressFound And bCityStateZipFo und And
bSubjectFound And bAccountNumFoun d) Then
Me.txtStatusBar .Value = "Creating record..."
' Found all the fields
Set dbDatabase = CurrentDb()
Set rsRecordset = dbDatabase.Open Recordset("tblC ustomers")
' Create a new record with parsed info
rsRecordset.Add New
rsRecordset.Fie lds(1).Value = UCase(strReques tDate)
rsRecordset.Fie lds(2).Value = UCase(strName)
rsRecordset.Fie lds(3).Value = UCase(strSender )
rsRecordset.Fie lds(4).Value = UCase(strAddres s)
rsRecordset.Fie lds(5).Value = UCase(strCitySt ateZip)
' rsRecordset.Fie lds(6).Value = UCase(strSubjec t)
rsRecordset.Fie lds(7).Value = UCase(strReturn Method)
rsRecordset.Fie lds(8).Value = UCase(strAccoun tNum)
rsRecordset.Fie lds(9).Value = UCase(strReturn Date)
rsRecordset.Fie lds(10).Value = UCase(strBoxTyp e)
rsRecordset.Fie lds(11).Value = UCase(strBoxQty )
rsRecordset.Fie lds(12).Value = UCase(strCredit Amount)
rsRecordset.Fie lds(13).Value = UCase(strConver terNumbers)
rsRecordset.Fie lds(14).Value = UCase(strCommen ts)
rsRecordset.Upd ate
rsRecordset.Clo se
Set rsRecordset = Nothing
dbDatabase.Clos e
Set dbDatabase = Nothing
Else
'Could not find all or some of the fields
'Add incomplete record to exceptions table for manual processing.
Set dbDatabase = CurrentDb()
Set rsRecordset = dbDatabase.Open Recordset("tblE xceptions")
rsRecordset.Add New
rsRecordset.Fie lds(1).Value = Me.txtEmail.Val ue
rsRecordset.Fie lds(2).Value = Now()
rsRecordset.Upd ate
rsRecordset.Clo se
Set rsRecordset = Nothing
dbDatabase.Clos e
Set dbDatabase = Nothing
'MsgBox "Could not find a field. Please try again.", vbExclamation
+ vbOKOnly
End If
' Clear email field and get ready for another one
Me.txtEmail.Val ue = Null
Me.txtEmail.Set Focus
Kill "C:\MailSave\Ge tInfo.txt"
Loop
DoCmd.SetWarnin gs False
DoCmd.OpenQuery "qry_LoadWo rk", acViewNormal, acEdit
DoCmd.OpenQuery "qry_UpdateBCSu bject", acViewNormal, acEdit
DoCmd.OpenQuery "qry_UpdateCRSu bject", acViewNormal, acEdit
DoCmd.OpenQuery "qry_DeletePars ed", acViewNormal, acEdit
Me.txtStatusBar .Value = "Creating record...Comple te."
Exit_cmdParse_C lick:
Exit Sub
End Sub
---------------------------------------------------------------------------------SAMPLE
TEXT FILE
Date: 2006-08-10-13-38-47
To: Stephen_Ng
From: <KDB Shared Services>
Subject: Box Credit - 501756
[Date]
Thu Aug 10 13:38:45 EDT 2006
[Novell ID]
SNG
[Subject]
Box Credit - 501756
[Customer's Name]
DIOMARIS GRULLON
[Street]
69 STUYVESANT AV APT 3
[City, State, Zip]
BROOKLYN NY, 11221
[Account Number]
07836-105575-02
[Corp]
7836
[Amount to Credit]
123
[Return Method]
Tech
[Tech Number]
123
[Date Returned]
08/10/2006
[Type of Equipment]
Digital
[Number of Boxes]
1
[Converter Numbers]
123
[Comments]
test
[Control Number]
658006
Comment