O'Reilly logo

Access™ 2007 VBA Bible: For Data-Centric Microsoft® Office Applications by Helen Feddema

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9. Working with Files and Folders

IN THIS CHAPTER

  • Creating Windows folders

  • Creating FolderPicker and FilePicker dialogs using the Office FileDialog object

  • Writing data to text files using the FileSystemObject, legacy VB statements, and ADO

  • Reading data from text files using the FileSystemObject, legacy VB statements, and ADO

  • Loading files into Attachment fields and saving attachments to files

In the previous chapters I discussed creating Word documents, Excel worksheets, and various types of Outlook items using VBA Automation code. But these aren't the only types of documents you need to work with—sometimes you need to create a plain text document, or import data from one into an Access table. But, before you can work with these documents, you need to work with folders. This chapter covers writing code that works with Windows Explorer folders and text files, using several different methods.

As Access versions have progressed, the available tools for working with files or folders have advanced. In Access 1.0, the notoriously cryptic callback function was the only way to get a list of files to display in a combo box or listbox. By Windows 95, the CommonDialog control was a possibility, at least if you had the Developer edition of Office. But the CommonDialog control was plagued with version problems—if you put one version of it on a form, and sent the database to another person who had a different version of the control, the other person would just get the mysterious message "There ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required