hello
i'm trying to parse out some data from the below format. first of all,
i import the text file into access97 table and the try to parse out.i
have a code written but when i run it, it does not go to the next "FM
TX#" string and there could be a maximum of 1000+. The code only
parses out the first "FM TX#" string set and then exits.what am i
doing wrong with the code and why does it not move to the next
instr(rst![field3].value, ""FM TX#"") ?? am i missing some objects?
any suggestions would be greatly appreciated :)
thanks in advance - jung
here are the variables that should be extracted:
FM TX #
Oper #
Name/add
Int#
Changed
From
To
Entered by
+++text file to parse out data+++++
FM TX # 11/22/03-001 Oper # 54
Name/add RUTH ELDRIDGE / Int# 69888
Changed NMAD_ADDRESSLIN E3
From 8821 COLUMBIA ROAD
To 7642 PRODUCTION DRIVE
Entered by PYMT at 07:41 AM
FM TX # 11/22/03-002 Oper # 54
Name/add RUTH ELDRIDGE / Int# 69888
Changed NMAD_CITY
From MAINEVILLE
To CINCINNATI
Entered by PYMT at 07:41 AM
FM TX # 11/22/03-003 Oper # 54
Name/add RUTH ELDRIDGE / Int# 69888
Changed NMAD_ZIP
From 45039
To 45237
Entered by PYMT at 07:41 AM
+++++++++++++++ +++++++++++++++ +++++
Here is the code:
' Return reference to current database.
Set db = CurrentDb
' Open recordset on Orders table.
Set rst = db.OpenRecordse t("DENVER", dbOpenDynaset)
Set rstclean = db.OpenRecordse t("CleanDataDen ver", dbOpenDynaset)
' Do until end of file.
rst.MoveFirst
'Do Until rst.EOF
'Open Current Record for editing
x = InStr(rst![field3].Value, "MAINTENANC E TRANSACTIONS ")
' Do While InStr(rst![field3].Value, "MAINTENANC E TRANSACTIONS
") <> 0
rst.MoveNext
rst.MoveNext
Do While InStr(rst![field3].Value, "FM TX #") <> 0
y = InStr(rst![field3].Value, "FM TX #")
If InStr(rst![field3].Value, "FM TX #") <> 0 Then
'Do Until IsNumeric(x) = False
rstclean.AddNew
rst.Edit
fmtxnum = Trim(Mid(rst![field3].Value,
InStr(rst![field3].Value, "FM TX # ") + 8, 13))
'opernum = Trim(Mid(rst![field3].Value,
InStr(rst![field3].Value, "Oper #") + 6, Len(rst![field3].Value) - 1)
- InStr(rst![field3].Value, "Oper #") + 6)
rst.MoveNext
nameaddress = Trim(Mid(rst![field3].Value,
InStr(rst![field3].Value, "Name/add ") + 9, 15))
'internalnum = Trim(Mid(rst![field3].Value,
InStr(rst![field3].Value, " Name/add ") + 9, 15))
rst.MoveNext
changedinfo = Trim(Mid(rst![field3].Value,
InStr(rst![field3].Value, "Changed ") + 9, 30))
rst.MoveNext
fromwhat = Trim(Mid(rst![field3].Value,
InStr(rst![field3].Value, "From ") + 5, 30))
rst.MoveNext
'If InStr(rst![Field].Value, " To ") <> 0 Then
' towhat = Trim(Mid(rst![field3].Value,
InStr(rst![field3].Value, "To ") + 2, 30))
'End If
rst.MoveNext
enterbywhom = Trim(Mid(rst![field3].Value,
InStr(rst![field3].Value, "Entered by ") + 11, 30))
rstclean![FMTX#].Value = fmtxnum
'rstclean![Oper#].Value = opernum
rstclean![Name/add].Value = nameaddress
'rstclean![Int#].Value = internalnum
rstclean![Changed].Value = changedinfo
rstclean![From].Value = fromwhat
'rstclean![To].Value = towhat
rstclean![Entered by].Value = enterbywhom
rstclean.Update
End If
rst.MoveNext
'x = Len(rst![field3].Value)
Loop
rst.MoveNext
i'm trying to parse out some data from the below format. first of all,
i import the text file into access97 table and the try to parse out.i
have a code written but when i run it, it does not go to the next "FM
TX#" string and there could be a maximum of 1000+. The code only
parses out the first "FM TX#" string set and then exits.what am i
doing wrong with the code and why does it not move to the next
instr(rst![field3].value, ""FM TX#"") ?? am i missing some objects?
any suggestions would be greatly appreciated :)
thanks in advance - jung
here are the variables that should be extracted:
FM TX #
Oper #
Name/add
Int#
Changed
From
To
Entered by
+++text file to parse out data+++++
FM TX # 11/22/03-001 Oper # 54
Name/add RUTH ELDRIDGE / Int# 69888
Changed NMAD_ADDRESSLIN E3
From 8821 COLUMBIA ROAD
To 7642 PRODUCTION DRIVE
Entered by PYMT at 07:41 AM
FM TX # 11/22/03-002 Oper # 54
Name/add RUTH ELDRIDGE / Int# 69888
Changed NMAD_CITY
From MAINEVILLE
To CINCINNATI
Entered by PYMT at 07:41 AM
FM TX # 11/22/03-003 Oper # 54
Name/add RUTH ELDRIDGE / Int# 69888
Changed NMAD_ZIP
From 45039
To 45237
Entered by PYMT at 07:41 AM
+++++++++++++++ +++++++++++++++ +++++
Here is the code:
' Return reference to current database.
Set db = CurrentDb
' Open recordset on Orders table.
Set rst = db.OpenRecordse t("DENVER", dbOpenDynaset)
Set rstclean = db.OpenRecordse t("CleanDataDen ver", dbOpenDynaset)
' Do until end of file.
rst.MoveFirst
'Do Until rst.EOF
'Open Current Record for editing
x = InStr(rst![field3].Value, "MAINTENANC E TRANSACTIONS ")
' Do While InStr(rst![field3].Value, "MAINTENANC E TRANSACTIONS
") <> 0
rst.MoveNext
rst.MoveNext
Do While InStr(rst![field3].Value, "FM TX #") <> 0
y = InStr(rst![field3].Value, "FM TX #")
If InStr(rst![field3].Value, "FM TX #") <> 0 Then
'Do Until IsNumeric(x) = False
rstclean.AddNew
rst.Edit
fmtxnum = Trim(Mid(rst![field3].Value,
InStr(rst![field3].Value, "FM TX # ") + 8, 13))
'opernum = Trim(Mid(rst![field3].Value,
InStr(rst![field3].Value, "Oper #") + 6, Len(rst![field3].Value) - 1)
- InStr(rst![field3].Value, "Oper #") + 6)
rst.MoveNext
nameaddress = Trim(Mid(rst![field3].Value,
InStr(rst![field3].Value, "Name/add ") + 9, 15))
'internalnum = Trim(Mid(rst![field3].Value,
InStr(rst![field3].Value, " Name/add ") + 9, 15))
rst.MoveNext
changedinfo = Trim(Mid(rst![field3].Value,
InStr(rst![field3].Value, "Changed ") + 9, 30))
rst.MoveNext
fromwhat = Trim(Mid(rst![field3].Value,
InStr(rst![field3].Value, "From ") + 5, 30))
rst.MoveNext
'If InStr(rst![Field].Value, " To ") <> 0 Then
' towhat = Trim(Mid(rst![field3].Value,
InStr(rst![field3].Value, "To ") + 2, 30))
'End If
rst.MoveNext
enterbywhom = Trim(Mid(rst![field3].Value,
InStr(rst![field3].Value, "Entered by ") + 11, 30))
rstclean![FMTX#].Value = fmtxnum
'rstclean![Oper#].Value = opernum
rstclean![Name/add].Value = nameaddress
'rstclean![Int#].Value = internalnum
rstclean![Changed].Value = changedinfo
rstclean![From].Value = fromwhat
'rstclean![To].Value = towhat
rstclean![Entered by].Value = enterbywhom
rstclean.Update
End If
rst.MoveNext
'x = Len(rst![field3].Value)
Loop
rst.MoveNext
Comment