The information in this article applies to:
SUMMARYIn the versions of Microsoft Excel listed at the beginning of this article, you can use DAO (Data Access Objects) to manipulate data in external databases. This article provides a macro example that demonstrates how you can append the records from two different tables using DAO commands. 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.aspWARNING: Your use or modification of the SQL statement provided in this article is at your own risk. Microsoft provides this SQL statement "as is" without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. Microsoft does not support modifications of the SQL statement to suit specific customer requirements. You can merge the results of two or more queries, tables, and SELECT statements in a single UNION operation. The following example demonstrates how you can use the UNION operation to append two tables:
If the January and February tables used in the AppendTables macro
appear as in the following tables
the results returned to Sheet1 using the macro are as follows
To use the Data Access Object commands in a Microsoft Excel Visual
Basic for Applications macro, the DAO library must be referenced. To
reference the DAO library use the following steps:
REFERENCESFor more information about DAO, click the Index tab in Microsoft Excel 97 Visual Basic Help, type the following text DAO, Overviewand then double-click the selected text to go to the "Data Access Objects Overview" topic. For more information about Data Access Objects, click the Index tab in Microsoft Excel 7.0 Help, type the following text DAO, Overviewand then double-click the selected text to go to the "Data Access Objects Overview" topic. For more information about the UNION sql operation, click the Index tab in Microsoft Excel Help, type the following text UNION Operationand then double-click the selected text to go to the "UNION Operation (SQL)" topic. Additional query words: 8.00 97
Keywords : xldao xlwin |
Last Reviewed: November 9, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |