tu ti je vb kod gdje prepisujem i gdje znam fiksnu duljinu polja iz txt fajla
testfile = "c:\podaci\prepis.txt"
Dim rezultat As String
Dim dato1 As DAO.Database
Dim rek1 As DAO.Recordset
Set dato1 = CurrentDb
Dim sqlupit1 As String
Dim TextLine
Open testfile For Input As #1
Do While Not EOF(1)
Line Input #1, TextLine
p1 = Mid(TextLine, 1, 5)
p2 = Mid(TextLine, 7, 6)
p3 = Mid(TextLine, 14, 2)
p4 = Mid(TextLine, 17, 2)
p5 = Val(Mid(TextLine, 20, 3))
p6 = Val(Mid(TextLine, 24, 3))
p7 = Replace(Mid(TextLine, 28, 8), ",", ".")
p8 = Mid(TextLine, 37, 5)
Me.Repaint
sqlupit1 = "select * from izsuma where sm=" & "'" & p1 & "' and brploc=" & "'" & p2 & "' and vr='" & p3 & "' and so=" & "'" & p4 & "' And d = " & p5 & " And l = " & p6 & " And cr = " & " '" & p8 & "'" _
& " and knjiga=" & "'" & brknj.Caption & "' and popratnica='" & popr.Caption & "'"
Set rek1 = dato1.OpenRecordset(sqlupit1)
If rek1.EOF Then
rek1.AddNew
rek1.Fields("sm") = p1
rek1.Fields("brploc") = p2
rek1.Fields("vr") = p3
rek1.Fields("so") = p4
rek1.Fields("d") = p5
rek1.Fields("l") = p6
rek1.Fields("m3") = p7
rek1.Fields("cr") = p8
rek1.Fields("knjiga") = brknj.Caption
rek1.Fields("popratnica") = popr.Caption
rek1.Fields("datumpop") = datpop
rek1.Update
End If
Loop
Close #1
rek1.Close
Set dato1 = Nothing