By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,530 Members | 891 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,530 IT Pros & Developers. It's quick & easy.

How do I print a .dat file?

P: 1
I created a program, and the input data gathered from the program is stored in a .dat file. There are three files. I want print the third file. My files are named (1), (2) (3). I use the Common Dialog Box to print the file. But the coding I am using doesn't work. An error message appears saying "Bad file name or number"
Is there any mistake in my coding?
Can I get some help please?
Thanks

This is the coding for the printing I am using
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdPrint_Click()
  2. cmndlgPrint.ShowPrinter
  3.  
  4. Printer.Print Tab(10); "Room Num"; Tab(10); "Computer Rental"; Tab(10); "TV rental"; Tab(10); "Fixed Rental"; Tab(10); "Water Rental"; Tab(10); "Electricity Rental"; Tab(10); "Overall rent"
  5.  
  6. Do While Not EOF(3)
  7. Printer.Print Tab(15); strMonth1; Tab(20); strRoomNum1; Tab(20); curFixedRentTV1; Tab(20); curFixedRentComp1; Tab(20); curFixedRent; Tab(20); curRentWater; Tab(20); curElecFinal; Tab(20); curFinal
  8. Loop
  9.  
  10. Printer.Print
  11.  
  12. End Sub
  13.  
Apr 22 '07 #1
Share this Question
Share on Google+
1 Reply


Expert 5K+
P: 8,434
...
Do While Not EOF(3)
Is this the statement which produces the error?

If so, you need to ensure the file is open for reading befoer executing this code.
Apr 22 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.