S
Suzi
Hi
I have inherited a database and the only way I can make this module work is
if it doesn't import the data properly go in and change the code lines. How
do I change it so I don't have to keep going into the module? The dateline
with the comment normal one usually works but sometimes I have to change it
for the files without a ctoload file in the archive, and once I even needed
a 3rd option. I find out where to change it by counting characters from the
locals window.
Thanks
Suzi
Public strFile As String
Public LineCounter As Integer
Public Dataline As String
Public RSTPar As Recordset
Public Linecount As Integer
Public Dateline As String
Public archivedate As Date
Public Function UPDPA()
Dim RSTPar As Recordset 'recordset name
Dim intFile As Integer
Set dbs = CurrentDb
Set RSTPar = CurrentDb.OpenRecordset("TblPrintArchive", dbOpenDynaset)
'select table and db
strFile = "C:\Archive\PDIR.txt" 'specifies file name
Open strFile For Input As #1
Do While Not EOF(1)
Line Input #1, Dataline
'Dateline = Mid(Dataline, 61, 2) & "/" & Mid(Dataline, 58, 2) &
"/" & Mid(Dataline, 64, 4)
Dateline = Mid(Dataline, 55, 2) & "/" & Mid(Dataline, 52, 2) &
"/" & Mid(Dataline, 58, 4) 'normal one
'Dateline = Mid(Dataline, 41, 2) & "/" & Mid(Dataline, 44, 2) &
"/" & Mid(Dataline, 47, 4) 'Required for archives without ctoload
If IsDate(Dateline) Then
'UPDATE RECORD (Parse Record)
With RSTPar
.AddNew
!DirName = Mid(Dataline, 10, 4)
!FileCreationDate = Dateline
!Filename = Trim(Mid(Dataline, 15, 37)) 'normal one
'!Filename = Trim(Mid(Dataline, 15, 26)) 'Required
for archives without ctoload
!archivedate = Now()
.Update
End With
Else
End If
Loop
Close #1
Kill strFile
MsgBox ("Records for " & Mid(Dataline, 10, 4) & " are added to the
database")
End Function
I have inherited a database and the only way I can make this module work is
if it doesn't import the data properly go in and change the code lines. How
do I change it so I don't have to keep going into the module? The dateline
with the comment normal one usually works but sometimes I have to change it
for the files without a ctoload file in the archive, and once I even needed
a 3rd option. I find out where to change it by counting characters from the
locals window.
Thanks
Suzi
Public strFile As String
Public LineCounter As Integer
Public Dataline As String
Public RSTPar As Recordset
Public Linecount As Integer
Public Dateline As String
Public archivedate As Date
Public Function UPDPA()
Dim RSTPar As Recordset 'recordset name
Dim intFile As Integer
Set dbs = CurrentDb
Set RSTPar = CurrentDb.OpenRecordset("TblPrintArchive", dbOpenDynaset)
'select table and db
strFile = "C:\Archive\PDIR.txt" 'specifies file name
Open strFile For Input As #1
Do While Not EOF(1)
Line Input #1, Dataline
'Dateline = Mid(Dataline, 61, 2) & "/" & Mid(Dataline, 58, 2) &
"/" & Mid(Dataline, 64, 4)
Dateline = Mid(Dataline, 55, 2) & "/" & Mid(Dataline, 52, 2) &
"/" & Mid(Dataline, 58, 4) 'normal one
'Dateline = Mid(Dataline, 41, 2) & "/" & Mid(Dataline, 44, 2) &
"/" & Mid(Dataline, 47, 4) 'Required for archives without ctoload
If IsDate(Dateline) Then
'UPDATE RECORD (Parse Record)
With RSTPar
.AddNew
!DirName = Mid(Dataline, 10, 4)
!FileCreationDate = Dateline
!Filename = Trim(Mid(Dataline, 15, 37)) 'normal one
'!Filename = Trim(Mid(Dataline, 15, 26)) 'Required
for archives without ctoload
!archivedate = Now()
.Update
End With
Else
End If
Loop
Close #1
Kill strFile
MsgBox ("Records for " & Mid(Dataline, 10, 4) & " are added to the
database")
End Function