473,761 Members | 3,651 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

My Code: Invalid Procedure call or argument

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

Aug 11 '06 #1
1 3212
It is probably failing when strEmail is an empty string, which is not a
null.

You could change:
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
to

If len(strEmail & "") = 0 then

If len(strEmail & "") = 0 Then
MsgBox "[email] field is blank. Please try again.",
vbExclamation + vbOKOnly
Me.txtEmail.Set Focus
Exit Sub
End If
I also don't understand why you are trying to get the right most
characters without getting the first. If that's what you want, then
Mid(strEmail,2) will work as well.
Chris Nebinger

Eric wrote:
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
Aug 11 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
10753
by: john | last post by:
Ran Windows update tonight. Since then I get this error: HTTP 500.100 - Internal Server Error - ASP error Internet Information Services -------------------------------------------------------------------------------- Technical Information (for support personnel) Error Type:
6
20664
by: mork | last post by:
I am so frustrated - any help is appreciated. When trying to use common functions like Left and/or Mid I get the following error: Run-time Error '5': Invalid Procedure Call or Argument In my searches it appears I am not the first, but the solution seems to be missing references. When I check my references, none are labelled as missing. I've removed all references and re-added them and the error
18
18416
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on a remote update of tables and fields and can't find enough information on these things. Also, how do you index a field in code?
14
1442
by: genus_ | last post by:
The below code compiles and runs smoothly. Can any one at least explain to me what its doing for first few lines? Thank you. Here's the code: #include <stdio.h> main(t,_,a) char *a; {return!0<t?t<3?main(-79,-13,a+main(-87,1-_,
2
4608
by: Zoury | last post by:
Hi there! I'm using a COM component from my C# application and I can't get it to work properly. I get a COMException (Invalid procedure call or argument) on this line : //*** ArbreSaisieClass as = new ArbreSaisieClass(); bool bSubLevel = true; bool bValid = false;
5
4267
by: Eric | last post by:
I run a program which read emails from a text file. There is some thing invalid in one or more text file. When program is busy doing parsing it shows that error and process stop. I dont know which text file has that error. Is it possible that i can handle that error during processing some thing i mean ignore line, email so that my process will not be interrupt. Error: Invalid Procedure call or argument Run time error 5
3
1400
by: rich9791 | last post by:
I was posting a application for on the web, filled in all the details, pressed submit and got the error code..(Error: 5: Invalid procedure call or argument (Invalid procedure call or argument line = 23) can anyone help me.
1
3183
by: PurpleWitch | last post by:
Hi there I'm using an Access 2000 DB on Office 2000. The following Pivot Table worked fine 2 days ago, but no I'm getting the "Invalid Procedure Call or Argument" error when using Pivot Table Wizard: Error Messages in the Column, and Count of Policy Number in the Data area. Any ideas? Thanks PW
1
2059
by: PrakashN | last post by:
Hai I have done validation for mandatory fields when adding a record in a Button click event.if i click that button using shot cut keys without selecting the option, i m receiving "Run-time error '5': Invalid procedure call or argument" in exe . please any one tell me teh reason for this.
1
6908
by: sureshl | last post by:
Page opens like this.... phone:123243453 email:henria@real.com but aftr clicking that button I need to display like this.. phone:12324**** email:hen***@******
0
10111
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9948
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7327
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6603
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5364
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3866
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3446
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2738
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.