Private Sub Nu_Poehali()
On Error GoTo Err_Nu_Poehali
Dim ReportHeader As String
Dim FileNameBAZ As String
Dim FileName_01 As String
Dim Lazha As String
Dim i As Long
FileName_01 = CurrentProject.Path & "\BAZ_Convert_01.txt"
FileNameBAZ = CurrentProject.Path & "\ATC1_051005_ISX.REP"
Open FileName_01 For Output As #1 'пишем
Open FileNameBAZ For Input As #2 'читаем
Do While Not EOF(2)
Line Input #2, Lazha
i = i + 1
If i < 5 Then
ReportHeader = ReportHeader & " | " & Trim(Lazha)
End If
If i > 8 Then
If Left(Lazha, 5) = "_____" Then
Exit Do
Else
Print #1, Mid(Lazha, 2)
End If
End If
Loop
Close #2
Close #1
CurrentDb.Execute "DELETE * FROM tab_REP;", dbSeeChanges
CurrentDb.Execute "INSERT INTO tab_REP(IshAb, BizAb, DateRazg, TimeFirst, TimeLast, DlitelnTEd, DlitelnImp, DateTimeRazg) " & _
"SELECT rtrim(mid(f1,1,14)), rtrim(mid(f1,15,16)), mid(f1,31,10), mid(f1,41,11), mid(f1,52,12), mid(f1,64,8), mid(f1,72), mid(f1,31,10) & ' ' & mid(f1,41,11) " & _
"FROM BAZ_Convert_01#txt IN '" & CurrentProject.Path & "'[Text;HDR=No;IMEX=2;]", dbSeeChanges
DoCmd.OpenTable "tab_REP", acViewNormal
Exit Sub
Err_Nu_Poehali:
'Call ErrorBases(Err)
End Sub
|