Microsoft Access Developer 34. File System Object, Read Write Text, Send Email, Data Export/Import

preview_player
Показать описание

TOPICS COVERED

File System Object, Lessons 3 - 5
Copy & Move Folders
Read & Write Text Files
Outlook Send Email Attachments
Convert Early to Late Binding
Customer Export & Import Changes
Track Changes Log

Today's class continues working with the File System Object. We'll do a lot with copying files and folders (including entire folders along with their subfolders). We will learn how to read and write files. We'll make a customer data change file that we can email to the customer, have them make changes, and then import those changes back into the database. We'll see how to send email with Outlook.

In Lesson 1, we will continue working with the File System Object. We will learn about CopyFolder, MoveFolder, DeleteFolder, listing all files in a folder, CopyFile, CopyFile with wildcards, CopyFile with a loop of the Files collection, and how to copy files based on their properties (files of a certain size, modified date, etc.).

In Lesson 2, we will learn how to write text files using the TextStream object. We will learn about CreateTextFile, Write, WriteLine, and WriteBlankLines. We will create a customer text file with all of the information we want to send to the customer for review and edit (name, address, phone, etc.) We will learn two ways to send email using Outlook (SendObject and Outlook.Application) so we can send the customer text file as an attachment. We'll convert the email code from Early to Late Binding.

In Lesson 3, we will learn how to read text files. We'll learn about OpenTextFile, Read, ReadLine, and ReadAll. We'll learn to tell when were AtEndOfLine and AtEndOfStream (the file). We will read in the changes that the customer made to their data file, update their customer record, and track changes in a change log.

KEYWORDS

microsoft access, ms access, #msaccess, #microsoftaccess, #help, #howto, #tutorial, #instruction, #learn, #lesson, #training, #database, access developer 34, file system object, opentextfile, createtextfile, copyfolder, copyfile, file properties, folder properties, folderexists, fileexists, customer export import, change data file, open text file, create text file, copy folder, copy file, folder exists, file exists

OUTLINE

1. File System Object, Part 3 (32:50)
CopyFolder, MoveFolder
DeleteFolder does NOT send to Recycle Bin
Deletes ALL Files and Subfolders
Again, check FolderExists or Error Handling
Force for Read Only Files/Folders
List all Files in Folder
FileExists, CopyFile, DeleteFile, MoveFile
CopyFile with Wildcards
CopyFile with Files Collection Loop
Copy based on Size, Date, etc.

2. File System Object, Part 4 (29:59)
TextStream Objects for Text Only (not binary)
OpenTextFile, CreateTextFile
ASCII vs. Unicode Text
WriteLine write a whole line of text with a CR/LF
Write writes the text without a CR/LF
Write out Customer Data File
Loop through controls on form
For Each C in Me.Controls
Tag property, Control Name, Value
Send Email with Outlook
DoCmd.SendObject acSendNoObject
Outlook.Application, MailItem
Converting Outlook code from Early to Late binding

3. File System Object, Part 5 (36:02)
OpenTextFile
ForReading (1) DEFAULT
ForWriting (2)
ForAppending (8)
Create if file doesn't already exist
TristateFalse (0) = Open as ASCII file DEFAULT
TristateMixed (-2) = Open either ASCII or Unicode
TristateTrue (-1) = Open as Unicode file
ReadLine, ReadAll, Read(X)
Read char by char method
AtEndOfLine, Column, Skip, SkipLine
Read back in Customer file changes
Рекомендации по теме