在上节已经讲述了把多个Excel文件导入到Access 2007里来,现在是把把生成的这些表里的数据合并到一个表里去,假设这表的名字叫aa.
导入的表名有两个1和2
下面是代码示例:
Dim query As QueryDef
Set query = CurrentDb.QueryDefs(0)
query.SQL = "INSERT INTO aa SELECT * FROM 1;"
query.Execute
query.SQL = "INSERT INTO aa SELECT * FROM 2;"
query.Execute
Set query = CurrentDb.QueryDefs(0)
query.SQL = "INSERT INTO aa SELECT * FROM 1;"
query.Execute
query.SQL = "INSERT INTO aa SELECT * FROM 2;"
query.Execute
怎么样,还是挺简单的吧!!!
Enjoy!