Hello everybody.
I'm trying to print in a .dat file but i don't know what is wrong with my code:

Code:
Private Sub Command1_Click()

On Error Resume Next

Dim Free As Integer

Fre = FreeFile()

Open "C:\Bill.dat" For Output As #Fre

Print #Fre,

Set mrs = New ADODB.Recordset
With mrs
.Open "select NR,EMERTIMI,PERSHKRIMI,SASIA from ****IET Where  NR ='" & txtProva.Text & "'", cnn
End With
If mrs.State > 0 Then mrs.Close
Do While Not mrs.EOF
Print #Fre, Tab(2); mrs("EMERTIMI"); Tab(14); mrs("PERSHKRIMI"); Tab(28); mrs("SASIA");
mrs.MoveNext
Loop
Close #Fre

End Sub
When i try this code, the project try to freeze my pc
Can anybody help me please?