Access Developer 30
Classic VB File I/O. Reading & Writing Text Files
Today's class is all about Classic VB File Input & Output. We will learn how to read and write text files. There are a lot of reasons why you would want to learn how to manually work with file I/O routines with your Access database, and I'll spend some time going over them in Lesson 1.
In Lesson 1, we will get an introduction to File Input/Output (File I/O). We're going to learn why you want to learn this stuff. We will learn about the two different types of file I/O: Classic VB and File System Object (FSO) which is newer. Then we'll learn the pros and cons of each.
Lesson 2 is a free bonus lesson. It's one of my TechHelp videos showing how to import data from Microsoft Excel CSV files and fixed width text files. It's a good foundation for what's coming next.
Lesson 3 is another free bonus lesson from my TechHelp videos. This one the members-only Extended Cut for the previous video where I show you how to import directly using VBA so it's a preview of what's going to be coming up in the rest of today's class. We're going to learn how to import a fixed-width file over 2 GB in size, which is larger than the Access maximum for a single database file or table.
In Lesson 4, we're going to start from the beginning with Classic VB File I/O. We're going to learn how to write out a text file. We'll learn the Open, Output, Print, Close, Append commands. We'll talk about what folders you can write to, what folders you have access to write to. CurrentProject.Path gets the folder that the database is in. FreeFile gives you an open file handle. How to use the Shell Command to open up Notepad to view your text file as soon as it's exported. We'll learn how to loop through the controls on a form so we can export all of the text box values from one form. Export customer data, customer list, and an invoice with all of the line item details and order total.
In Lesson 5, we will learn how to read text files. We will open a file for input, read in lines of text with the Line Input command. Read all lines to the EOF (End of File). We'll use a recordset to add values to a table from the file input. We will read in customer data and survey responses. I'll show you how to copy and paste a customer's survey response data into a field on a form, export that data to a file, and the read in and parse the data one line at a time.
Enroll now so that you can watch these lessons, learn with us, post questions, and more.
Please feel free to post your questions or comments below. If you are not sure as to whether or not this product will meet your needs, I'd rather help you before you buy it. Remember, all sales are final. Thank you.
Subscribe to Access Developer 30
Get notifications when this page is updated
Check out these other pages that may be of interest to you: