The information in this article applies to:
SUMMARYIn Visual Basic for Applications, the CopyFromRecordset method is used to return data from a Data Access Object. It will return only data and will not return the database's field headings. MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals 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 needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web: http://www.microsoft.com/support/supportnet/overview/overview.aspThe CopyFromRecordset method is used to return data from an open database to an active worksheet. The method does not have an argument that will return the field headings of the database. Additional code is needed to place the field headings on the worksheet. The following example demonstrates the code needed to return the field headings as well as the data. ExampleBefore you type the following code on a module sheet, you must create a reference to the Microsoft DAO Object Library. To do this, activate the Module sheet, click References on the Tools menu, and select the Microsoft DAO 3.5 Object Library check box (the 3.0 Object Library check box in version 7.0).
REFERENCESFor more information about the Visual Basic CopyFromRecordset method, click the Index tab in Microsoft Excel Help, type the following text copyfrdouble-click the selected text, and then double-click CopyFromRecordset Method in the Topics Found dialog box to go to the CopyFromRecordset Method topic. Additional query words:
Keywords : kbprg kbdta kbdtacode KbVBA kbhowto |
Last Reviewed: December 29, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |