Article ID: 279508 - View products that this article applies to.
This article was previously published under Q279508
For a Microsoft Office Access 2003 version of this article, see 824272Advanced: Requires expert coding, interoperability, and multiuser skills.
This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).
This article shows you how to use the new FileDialog method in Microsoft Access to display the built-in file dialog box and to determine what files the user selected.
NOTE: The FileDialog method works only in the full retail version of Microsoft Access. This method does not work in a Microsoft Access run-time application.
In earlier versions of Microsoft Access, you could not display the file dialog box without using either the Microsoft Common Dialog ActiveX Control or by making calls to the Windows API.
In Microsoft Access 2002, the FileDialog method allows you to display the file dialog box used by Microsoft Access and to determine what files were selected by the user. The SelectedItems collection of the FileDialog object contains the paths to the files selected by the user. By using a For...Each loop, you can enumerate this collection and display each file. The following example loops through the ItemsSelected collection and displays the files in a list box.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
For more information about what you can do with the file dialog box, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type filedialog object in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
Article ID: 279508 - Last Review: October 11, 2006 - Revision: 4.2
Contact us for more help