Наконец-то я все решил сам.верхний и нижний колонтитулы имеют разное количество столбцов.Я использовал оператор ввода строки, чтобы проверить каждую строку моего текстового файла.Вот мой код:
Sub FileUpload_CMP_Funding()
Dim sFile, sText As String
Dim dText As Variant
Dim db As Database
Dim rst As Recordset2
Dim i As Long
sFile = "C:\NotBackedUp\testfile\CMPFUNding.out"
Open sFile For Input As #1
Do While Not EOF(1)
Line Input #1, sText
dText = Empty
dText = Split(vText(i), ",")
'My main content has 24 columns
If UBound(dText) - LBound(dText) + 1 = 24 Then
If dText(0) <> "Product ID" Then 'skip the header row at the 4th rows
Set db = CurrentDb
Set rst = db.OpenRecordset("tblCMP_Funding", dbOpenDynaset)
rst.AddNew
rst!ProductID = Trim(Replace(dText(0), """", ""))
rst!FundID = Trim(Replace(dText(1), """", ""))
""
'Update whatever field is required to be updated
rst.Update
Set db = Nothing
Set rst = Nothing
End If
End If
Loop
Close #1
End Sub
Надеюсь, это поможет всем, у кого такие же требования