For
Each
FI
In
FO.Files
Datei = FI.Name
DateiTyp = Right(Datei, InStr(1, StrReverse(Datei),
"."
) - 1)
DateiName = Left(Datei, InStr(1, Datei,
"."
) - 1)
If
DateiTyp =
"pdf"
Then
SubNumber = Right(DateiName, InStr(1, StrReverse(DateiName),
"-"
) - 1)
WholePath =
"#"
& pfad &
"\" & Datei & "
#"
PosOfUnderline = InStr(1, StrReverse(DateiName),
"_"
)
location = Right(pfad, InStr(1, StrReverse(pfad), "\") - 1)
location = Replace(location,
"-"
,
" "
)
If
PosOfUnderline > 0
Then
DateiNameOhneIP = Right(DateiName, InStr(1, StrReverse(DateiName),
"_"
) - 1)
Number = Left(DateiNameOhneIP, InStr(1, DateiNameOhneIP,
"-"
) - 1)
Else
Number = Left(DateiName, InStr(1, DateiName,
"-"
) - 1)
End
If
SQL_Statement =
"INSERT INTO InspectionProtokoll (IP_Number,IP_Subnummer,Datei,Ort) VALUES ("
& Number & _
", "
& SubNumber &
", '"
& WholePath &
"','"
& location &
"')"
DoCmd.SetWarnings
True
DoCmd.RunSQL SQL_Statement
End
If
Next