Code too large Extracting Txt Srtings

R

rebelscum0000

Dear all

I want to extract the following strings from this txt file

"10/10/2007", "Hash","C:\Dups V.1.0\", "NEw 250", "00:00:14"
"9","609", "89", "281", "12,451", "14,875", "0", "0" and "1"

Info
- date: 10/10/2007
- process: Hash
- source: C:\Dups V.1.0\
- source volume label: NEw 250

Basic statistics
- time elapsed: 00:00:14
- overall transfer [kB/s]: 9,609
- folders processed: 89
- files processed: 281
- source bytes read: 131 MB (137,926,042 bytes)
- source average transfer [kB/s]: 12,451
- source clean transfer [kB/s]: 14,875

Errors
- errors: 0
- warnings: 0
- other: 1

I repeated several times the same code to extract each one of the
strings and my code is too large I think there is going to be an
easier way to do this, any ideas, suggestions or clues are more than
welcome

Thanks in advance
Regards,
Antonio Macias

This my large too large code

Sub OpenWinBrowse()

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strStartPath As String
Dim MyDlg As New DialogClass
Dim GetFolder As String
Dim strPath As String
Dim MyLenstrPath As String
Dim MyMidPath As String
Dim MyCounter As Integer
Dim SearchChar As String
Dim strFile As String
Dim strBuffer As String
Dim intFile As Integer
Dim MyLen As Integer
Dim MyPos As Integer
Dim MyStart As Integer
Dim MyPos1 As Integer
Dim MidWords As String
Dim MidWords1 As String
Dim TrimString As String

'On Error GoTo ErrorHandling

'strStartPath = "C:\"


With MyDlg
.TypeFile = 0 'All file Types
.TypeFile = 4 'Text Files
.StartPathFromFileStr = "C:\"
.DialogType = "Browse"
End With

MyDlg.Show

GetFolder = MyDlg.ReturnFilePath
strPath = GetFolder
MyLenstrPath = Len(strPath)
MyMidPath = Mid(strPath, 4, MyLenstrPath)

SearchChar1 = "- date:" 'Field Name
MyDate
SearchChar2 = "- process:" 'Field Name
MyProcess
SearchChar3 = "- source:" 'Field Name
MySource
SearchChar4 = "- source volume label:" 'Field Name
MyVolumeLabel
SearchChar5 = "- time elapsed:" 'Field Name
MyTimeElapsed
SearchChar6 = "- overall transfer [kB/s]:" 'Field Name
MyOverallTransefer
SearchChar7 = "- folders processed:" 'Field Name
MyFoldersProcesed
SearchChar8 = "- files processed:" 'Field Name
MyFilesProcesed
SearchChar9 = "- source average transfer [kB/s]:" 'Field Name
MySourceAverage
SearchChar10 = "- source clean transfer [kB/s]:" 'Field Name
MyCleanTransfer
SearchChar11 = "- errors:" 'Field Name
MyErrors
SearchChar12 = "- warnings:" 'Field Name
MyWarnings
SearchChar13 = "- other:" 'Field Name
MyOther

'MyDate
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar1)
MyPos = InStr(1, strBuffer, SearchChar1, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyDate = Trim(MidWords1)

'MyProcess
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar2)
MyPos = InStr(1, strBuffer, SearchChar2, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyProcess = Trim(MidWords1)

'MySource
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar3)
MyPos = InStr(1, strBuffer, SearchChar3, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMySource = Trim(MidWords1)

'MyVolumeLabel
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar4)
MyPos = InStr(1, strBuffer, SearchChar4, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyVolumeLabel = Trim(MidWords1)

'MyTimeElapsed
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar5)
MyPos = InStr(1, strBuffer, SearchChar5, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyTimeElapsed = Trim(MidWords1)

'MyOverallTransefer
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar6)
MyPos = InStr(1, strBuffer, SearchChar6, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyOverallTransefer = Trim(MidWords1)

'MyFoldersProcesed
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar7)
MyPos = InStr(1, strBuffer, SearchChar7, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyFoldersProcesed = Trim(MidWords1)

'MyFilesProcesed
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar8)
MyPos = InStr(1, strBuffer, SearchChar8, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyFilesProcesed = Trim(MidWords1)

'MySourceAverage
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar9)
MyPos = InStr(1, strBuffer, SearchChar9, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMySourceAverage = Trim(MidWords1)

'MyCleanTransfer
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar10)
MyPos = InStr(1, strBuffer, SearchChar10, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyCleanTransfer = Trim(MidWords1)

'MyErrors
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar11)
MyPos = InStr(1, strBuffer, SearchChar11, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyErrors = Trim(MidWords1)

'MyWarnings
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar12)
MyPos = InStr(1, strBuffer, SearchChar12, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyWarnings = Trim(MidWords1)

'MyOther
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar11)
MyPos = InStr(1, strBuffer, SearchChar11, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyErrors = Trim(MidWords1)

'MyWarnings
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar13)
MyPos = InStr(1, strBuffer, SearchChar13, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyOther = Trim(MidWords1)


'Initialize Variables
Set db = CurrentDb
Set rs = CurrentDb.OpenRecordset("Comparations_Tbl",
dbOpenDynaset)

With rs
.AddNew 'Add a new record
!MyDate = TrimStringMyDate
!MyProcess = TrimStringMyProcess
!MySource = TrimStringMySource
!MyVolumeLabel = TrimStringMyVolumeLabel
!MyTimeElapsed = TrimStringMyTimeElapsed
!MyOverallTransefer = TrimStringMyOverallTransefer
!MyFoldersProcesed = TrimStringMyFoldersProcesed
!MyFilesProcesed = TrimStringMyFilesProcesed
!MySourceAverage = TrimStringMySourceAverage
!MyCleanTransfer = TrimStringMyCleanTransfer
!MyErrors = TrimStringMyErrors
!MyWarnings = TrimStringMyWarnings
!MyOther = TrimStringMyOther
'!MyPath = strPath
.Update 'Write the new record to the table
.Bookmark = .LastModified
End With

rs.Close
db.Close


Exit Sub
ErrorHandling:
MsgBox "In Module022 Error Number: " & Err & " Description " &
Err.Description

End Sub
 
L

Larry Linson

What is it that you want to do with the information, once you get it? You
can import a comma-delimited file, you know. There's a Wizard for doing so,
and you can build your Table in advance. Unlike the "standard" delimited
file, you have dates, times, and numbers all enclosed in quotation marks, so
you are likely to have to do a little manipulation on the data, but you
don't have to parse the file in order to put it in Fields in the Table.

Larry Linson
Microsoft Access MVP

rebelscum0000 said:
Dear all

I want to extract the following strings from this txt file

"10/10/2007", "Hash","C:\Dups V.1.0\", "NEw 250", "00:00:14"
"9","609", "89", "281", "12,451", "14,875", "0", "0" and "1"

Info
- date: 10/10/2007
- process: Hash
- source: C:\Dups V.1.0\
- source volume label: NEw 250

Basic statistics
- time elapsed: 00:00:14
- overall transfer [kB/s]: 9,609
- folders processed: 89
- files processed: 281
- source bytes read: 131 MB (137,926,042 bytes)
- source average transfer [kB/s]: 12,451
- source clean transfer [kB/s]: 14,875

Errors
- errors: 0
- warnings: 0
- other: 1

I repeated several times the same code to extract each one of the
strings and my code is too large I think there is going to be an
easier way to do this, any ideas, suggestions or clues are more than
welcome

Thanks in advance
Regards,
Antonio Macias

This my large too large code

Sub OpenWinBrowse()

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strStartPath As String
Dim MyDlg As New DialogClass
Dim GetFolder As String
Dim strPath As String
Dim MyLenstrPath As String
Dim MyMidPath As String
Dim MyCounter As Integer
Dim SearchChar As String
Dim strFile As String
Dim strBuffer As String
Dim intFile As Integer
Dim MyLen As Integer
Dim MyPos As Integer
Dim MyStart As Integer
Dim MyPos1 As Integer
Dim MidWords As String
Dim MidWords1 As String
Dim TrimString As String

'On Error GoTo ErrorHandling

'strStartPath = "C:\"


With MyDlg
.TypeFile = 0 'All file Types
.TypeFile = 4 'Text Files
.StartPathFromFileStr = "C:\"
.DialogType = "Browse"
End With

MyDlg.Show

GetFolder = MyDlg.ReturnFilePath
strPath = GetFolder
MyLenstrPath = Len(strPath)
MyMidPath = Mid(strPath, 4, MyLenstrPath)

SearchChar1 = "- date:" 'Field Name
MyDate
SearchChar2 = "- process:" 'Field Name
MyProcess
SearchChar3 = "- source:" 'Field Name
MySource
SearchChar4 = "- source volume label:" 'Field Name
MyVolumeLabel
SearchChar5 = "- time elapsed:" 'Field Name
MyTimeElapsed
SearchChar6 = "- overall transfer [kB/s]:" 'Field Name
MyOverallTransefer
SearchChar7 = "- folders processed:" 'Field Name
MyFoldersProcesed
SearchChar8 = "- files processed:" 'Field Name
MyFilesProcesed
SearchChar9 = "- source average transfer [kB/s]:" 'Field Name
MySourceAverage
SearchChar10 = "- source clean transfer [kB/s]:" 'Field Name
MyCleanTransfer
SearchChar11 = "- errors:" 'Field Name
MyErrors
SearchChar12 = "- warnings:" 'Field Name
MyWarnings
SearchChar13 = "- other:" 'Field Name
MyOther

'MyDate
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar1)
MyPos = InStr(1, strBuffer, SearchChar1, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyDate = Trim(MidWords1)

'MyProcess
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar2)
MyPos = InStr(1, strBuffer, SearchChar2, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyProcess = Trim(MidWords1)

'MySource
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar3)
MyPos = InStr(1, strBuffer, SearchChar3, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMySource = Trim(MidWords1)

'MyVolumeLabel
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar4)
MyPos = InStr(1, strBuffer, SearchChar4, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyVolumeLabel = Trim(MidWords1)

'MyTimeElapsed
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar5)
MyPos = InStr(1, strBuffer, SearchChar5, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyTimeElapsed = Trim(MidWords1)

'MyOverallTransefer
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar6)
MyPos = InStr(1, strBuffer, SearchChar6, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyOverallTransefer = Trim(MidWords1)

'MyFoldersProcesed
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar7)
MyPos = InStr(1, strBuffer, SearchChar7, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyFoldersProcesed = Trim(MidWords1)

'MyFilesProcesed
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar8)
MyPos = InStr(1, strBuffer, SearchChar8, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyFilesProcesed = Trim(MidWords1)

'MySourceAverage
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar9)
MyPos = InStr(1, strBuffer, SearchChar9, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMySourceAverage = Trim(MidWords1)

'MyCleanTransfer
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar10)
MyPos = InStr(1, strBuffer, SearchChar10, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyCleanTransfer = Trim(MidWords1)

'MyErrors
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar11)
MyPos = InStr(1, strBuffer, SearchChar11, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyErrors = Trim(MidWords1)

'MyWarnings
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar12)
MyPos = InStr(1, strBuffer, SearchChar12, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyWarnings = Trim(MidWords1)

'MyOther
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar11)
MyPos = InStr(1, strBuffer, SearchChar11, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyErrors = Trim(MidWords1)

'MyWarnings
'Initialize Variables
MyCounter = 0

strFile = GetFolder & "\" & MyMidPath & ".txt"
Debug.Print strFile
strBuffer = Space(FileLen(strFile))
intFile = FreeFile()
Open strFile For Binary Access Read As intFile
Get #intFile, , strBuffer
Debug.Print strBuffer
MyLen = Len(SearchChar13)
MyPos = InStr(1, strBuffer, SearchChar13, 1)
MyStart = MyPos + 1 + MyLen

Do
MyPos1 = MyStart + MyCounter
MidWords = Mid(strBuffer, MyPos1, 1)

MyCounter = MyCounter + 1

Loop Until MidWords = Chr(13)
MidWords1 = Mid(strBuffer, MyStart, MyCounter - 1)
TrimStringMyOther = Trim(MidWords1)


'Initialize Variables
Set db = CurrentDb
Set rs = CurrentDb.OpenRecordset("Comparations_Tbl",
dbOpenDynaset)

With rs
.AddNew 'Add a new record
!MyDate = TrimStringMyDate
!MyProcess = TrimStringMyProcess
!MySource = TrimStringMySource
!MyVolumeLabel = TrimStringMyVolumeLabel
!MyTimeElapsed = TrimStringMyTimeElapsed
!MyOverallTransefer = TrimStringMyOverallTransefer
!MyFoldersProcesed = TrimStringMyFoldersProcesed
!MyFilesProcesed = TrimStringMyFilesProcesed
!MySourceAverage = TrimStringMySourceAverage
!MyCleanTransfer = TrimStringMyCleanTransfer
!MyErrors = TrimStringMyErrors
!MyWarnings = TrimStringMyWarnings
!MyOther = TrimStringMyOther
'!MyPath = strPath
.Update 'Write the new record to the table
.Bookmark = .LastModified
End With

rs.Close
db.Close


Exit Sub
ErrorHandling:
MsgBox "In Module022 Error Number: " & Err & " Description " &
Err.Description

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top