| View previous topic :: View next topic |
| Author |
Message |
vkres1 Newbie
Joined: 31 Aug 2005 Posts: 3
|
Posted: Aug 31st, 2005 07:04 PM Post subject: creating a text file |
|
|
I am able to retrieve data from access data base from VB6.0. what i need is i need to create a text file from that data. can you guys give me some code on how to create text file.
here is my code that i am retrieving the data from access
Private Sub cmdList_Click()
Dim rs As New ADODB.Recordset
lstDetails.Clear
rs.Open "select * from Bnc", cn
Do Until rs.EOF
lstDetails.AddItem (rs!counter_name & ": " & rs!Counter)
rs.MoveNext
Loop
rs.Close
End Sub |
|
| Back to top |
|
P.T.A.M. Administrator

Joined: 08 Oct 2003 Posts: 752 Location: Greece
|
Posted: Aug 31st, 2005 07:14 PM Post subject: Re: creating a text file |
|
|
I haven't tested this but have a look at the bold lines
| Quote: | Private Sub cmdList_Click()
Dim rs As New ADODB.Recordset
lstDetails.Clear
rs.Open "select * from Bnc", cn
Open "C:\filename.txt" For Output As #1
Do Until rs.EOF
Print #1, rs!counter_name & ": " & rs!Counter
rs.MoveNext
Loop
Close #1
rs.Close
End Sub |
_________________ No one is completely useless. They can at least be an example of what to avoid. |
|
| Back to top |
|
ASoufan Regular

Joined: 15 Aug 2005 Posts: 56 Location: Jordan
|
Posted: Sep 1st, 2005 02:25 PM Post subject: |
|
|
Dim Location
Location = App.Path & "\NewFile.txt"
F = FreeFile
Open Location For Output As #F
Print #F, Your data goes here
Close #F _________________ Ahmed Soufan |
|
| Back to top |
|
|