I finally found a sollution. It works with the original .txt file, and imports it as I want it.
VBA Code:
Code:
Option Compare Database
Function Macro1()
'' dim variables
Dim tmp As String, temp() As String
Dim rs As Recordset
'' open source for reading
Open "My\File\Location\File.txt" For Input As #1
'' attach recordset to table
Set rs = CurrentDb.OpenRecordset("Target_Table")
'' loop source - read line-by-line until its end
Do Until EOF(1)
'' read one line
Line Input #1, tmp
'' look if it is a header, if yes, extract and store the number
If Left(tmp, 12) = "Arbeitsplatz" Then num = Trim(Mid(tmp, 17, 8))
'' look if it is a data line
If InStr(tmp, "|") > 0 And InStr(tmp, "Woche") = 0 Then
'' divide the line to separate fields
temp = Split(tmp, "|")
With rs
'' add new, empty, record
.AddNew
'' set values into fields
!Arbeitsplatz = num
!Woche = temp(1)
!Bedarf = temp(2)
!Angebot = temp(3)
!Belast = temp(4)
!Freie_Kap = temp(5)
!Einh = temp(6)
'' save editions
.Update
End With
End If
'' loop to reading the next line
Loop
'' close source file and recordset
Close #1
rs.Close
Set rs = Nothing
End Function
I hope this helps someone (It helped me a LOT)