J
JIT
I am recieving an error message that simply states "13." I have over 50,000
records in this data set and it shows the error for each one. The following
is the VB code.
Option Compare Database
Function ImportPIC31004()
Dim Path As String
Dim File As String
Path = "P:\111111Supply Chain\"
File = "PIC31004.txt"
ReadPIC31004File Path, File
End Function
Function ReadPIC31004File(FilePath As String, DataFile As String)
Dim Inline As String, rst As DAO.Recordset
On Error GoTo ErrHandler
Set rst = CurrentDb.OpenRecordset("ASN Data Current")
Open FilePath + DataFile For Input As #1
Line Input #1, Inline
Do Until EOF(1)
rst.AddNew
rst!PDC = Left(Inline, 5)
rst![Conveyance Number] = Mid(Inline, 6, 10)
rst![Part Number] = Mid(Inline, 17, 10)
rst![Supplier Code] = Mid(Inline, 28, 5)
rst![Supplier Ship Date] = DateValue(Mid(Inline, 36, 10))
rst![Shipper Number] = Mid(Inline, 47, 16)
rst![ASN/ASC Bill of Lading] = Mid(Inline, 64, 17)
rst![ASN/ASC Qty] = Val(Mid(Inline, 81, 8))
rst![Carrier SCAC] = Mid(Inline, 90, 4)
rst![Tran Mode] = Mid(Inline, 98, 2)
rst![Tran Code] = Mid(Inline, 104, 2)
rst![# Days Old] = Val(Mid(Inline, 112, 3))
rst![Shpmt Srce] = Mid(Inline, 129, 1)
rst.Update
Line Input #1, Inline
Loop
ErrHandler:
Select Case Err
Case 0
Exit Function
Case 55
Close #1
Resume
Case Else
MsgBox Err
MsgBox Err.Description
Resume
End Select
End Function
Can anyone look this over and tell me what is wrong with this import?
records in this data set and it shows the error for each one. The following
is the VB code.
Option Compare Database
Function ImportPIC31004()
Dim Path As String
Dim File As String
Path = "P:\111111Supply Chain\"
File = "PIC31004.txt"
ReadPIC31004File Path, File
End Function
Function ReadPIC31004File(FilePath As String, DataFile As String)
Dim Inline As String, rst As DAO.Recordset
On Error GoTo ErrHandler
Set rst = CurrentDb.OpenRecordset("ASN Data Current")
Open FilePath + DataFile For Input As #1
Line Input #1, Inline
Do Until EOF(1)
rst.AddNew
rst!PDC = Left(Inline, 5)
rst![Conveyance Number] = Mid(Inline, 6, 10)
rst![Part Number] = Mid(Inline, 17, 10)
rst![Supplier Code] = Mid(Inline, 28, 5)
rst![Supplier Ship Date] = DateValue(Mid(Inline, 36, 10))
rst![Shipper Number] = Mid(Inline, 47, 16)
rst![ASN/ASC Bill of Lading] = Mid(Inline, 64, 17)
rst![ASN/ASC Qty] = Val(Mid(Inline, 81, 8))
rst![Carrier SCAC] = Mid(Inline, 90, 4)
rst![Tran Mode] = Mid(Inline, 98, 2)
rst![Tran Code] = Mid(Inline, 104, 2)
rst![# Days Old] = Val(Mid(Inline, 112, 3))
rst![Shpmt Srce] = Mid(Inline, 129, 1)
rst.Update
Line Input #1, Inline
Loop
ErrHandler:
Select Case Err
Case 0
Exit Function
Case 55
Close #1
Resume
Case Else
MsgBox Err
MsgBox Err.Description
Resume
End Select
End Function
Can anyone look this over and tell me what is wrong with this import?