W
Wendy
I am importing data into recordset from a text file the only problem is I
don't want the data which is on every other line. I tried to kill the line
if the data = what I didn't want but that didn't work. This is my code so
far.
Thanks
Wendy
Private Function UPDPA()
Dim RSTPar As Recordset 'recordset name
Set dbs = CurrentDb
Set RSTPar = CurrentDb.OpenRecordset("TblPrintArchive", dbOpenDynaset)
'select table and db
Filename = "C:\import\ddirtest.txt" 'specifies file name
Open Filename For Input As #1
Do While Not EOF(1)
Line Input #1, Dataline
If Left(Dataline, 5) = "STORE" Then
dirnameline = Mid(Dataline, 30, 4)
Else
Dataline = Mid(Dataline, 16, 25)
End If
'UPDATE RECORD (Parse Record)
With RSTPar
.AddNew
!DirName = dirnameline
!Filename = Trim(Dataline)
.Update
End With
Loop
Close #1
Kill Filename
End Function
don't want the data which is on every other line. I tried to kill the line
if the data = what I didn't want but that didn't work. This is my code so
far.
Thanks
Wendy
Private Function UPDPA()
Dim RSTPar As Recordset 'recordset name
Set dbs = CurrentDb
Set RSTPar = CurrentDb.OpenRecordset("TblPrintArchive", dbOpenDynaset)
'select table and db
Filename = "C:\import\ddirtest.txt" 'specifies file name
Open Filename For Input As #1
Do While Not EOF(1)
Line Input #1, Dataline
If Left(Dataline, 5) = "STORE" Then
dirnameline = Mid(Dataline, 30, 4)
Else
Dataline = Mid(Dataline, 16, 25)
End If
'UPDATE RECORD (Parse Record)
With RSTPar
.AddNew
!DirName = dirnameline
!Filename = Trim(Dataline)
.Update
End With
Loop
Close #1
Kill Filename
End Function