Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open two text files in one app 2

Status
Not open for further replies.

tmangin

Programmer
Oct 29, 2003
16
US
Hi,
I need to open a text file for Input, then open another text file to write output to. Is this possible in a single VB app (.exe)? Below is a sample of what I have right now, however, I'm having problems with it.

Public Sub Form_Load()
Open "C:\iFtpSvc\Hms-ftppro\users\RCI27\RCI27.txt" For Input As 1 'Opens The File And Names It #1
Call PrintReport
End Sub

Public Sub PrintReport()
Open "C:\iFtpSvc\Hms-ftppro\users\RCI27\Report.txt" For Output As 1
Print #1, "WE RECEIVED THE FOLLOWING ON "; MyDate; ":"
Print #1, Chr(13)

Any input will help!
Thanks!
 
Name the second file as 2.

See freefile.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
instead of 1 and 2, use fn and fm. Before you use the open command, use fn=freefile and then fm=freefile. This way, there will never be a clash of filenumbers.

BB
 
Thank you both for your replies...they were both very helpful!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top