Private Sub Command15_Click() Dim Putanja As String Dim Db As Database Dim Rs As Recordset Dim temp As String Dim Fld As Field Dim ImeFajla As String, Znak As String Dim DuzStr As Integer, I As Integer On Error GoTo Greska ImeFajla = Me.Naziv DuzStr = Len(ImeFajla) For I = 1 To DuzStr Znak = Mid(ImeFajla, I, 1) If Znak = " " Then ImeFajla = Mid(ImeFajla, 1, I - 1) & "_" & Mid(ImeFajla, I + 1) End If Next I Set Db = CurrentDb Set Rs = Db.OpenRecordset("SELECT * FROM T_Tacke WHERE LokacijaID=" & Me.LokacijaID) Rs.MoveFirst Putanja = FindDatabase(2, ImeFajla) If Asc(Right(Putanja, 1)) = 0 Then Putanja = Mid(Putanja, 1, Len(Putanja) - 1) End If If Right(Putanja, 4) <> ".txt" Then Putanja = Putanja & ".txt" End If Close #1 <======= ŠTA OVAJ ZATVARA ? Open Putanja For Output Shared As #1 Do While Not Rs.EOF For Each Fld In Rs.Fields If Fld <> "" Then temp = temp & Fld & vbTab End If Next Fld If Format$(temp) <> "" Then Print #1, temp End If temp = "" Rs.MoveNext Loop Close #1 Izlaz: Exit Sub Greska: MsgBox "Greška broj: " & Err.Number & vbCr & Err.Description Resume Izlaz Kraj: End Sub