Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » General

Post new topic   Reply to topic
creating a text file
View previous topic :: View next topic  
Author Message
vkres1
Newbie


Joined: 31 Aug 2005
Posts: 3

PostPosted: Aug 31st, 2005 07:04 PM    Post subject: creating a text file Reply with quote

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
View user's profile Send private message
P.T.A.M.
Administrator


Joined: 08 Oct 2003
Posts: 752
Location: Greece

PostPosted: Aug 31st, 2005 07:14 PM    Post subject: Re: creating a text file Reply with quote

I haven't tested this but have a look at the bold lines Smile

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
View user's profile Send private message Send e-mail Visit poster's website ICQ Number
ASoufan
Regular


Joined: 15 Aug 2005
Posts: 56
Location: Jordan

PostPosted: Sep 1st, 2005 02:25 PM    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » General All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic