vba 访问获取所有表

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2076422/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 11:13:49  来源:igfitidea点击:

Access get all tables

sqlms-accessvba

提问by amr osama

Is there a way in by sql statement or vba code to return all tables from access file? "I don't know the name of the tables"

有没有办法通过 sql 语句或 vba 代码从访问文件中返回所有表?“我不知道桌子的名字”

like when you want to have all fields in a table you use '*' regardless the names of the fields.

就像当您想要在表中包含所有字段时,无论字段名称如何,都使用“*”。

but how to get all tables?!!!!

但是如何获得所有表?!!!

回答by Adriaan Stander

This will bring back all tables in the MS Access database (including linked tables)

这将带回 MS Access 数据库中的所有表(包括链接表)

SELECT MSysObjects.*, MSysObjects.Type
FROM MSysObjects
WHERE (((MSysObjects.Type)=1)) OR (((MSysObjects.Type)=6));

It also inclued Sys tables, so you might want to exclude tables starting with MSys

它还包括 Sys 表,因此您可能希望排除以MSys开头的表

Have a look at

看一下

回答by Adam Pierce

Depends what kind of database you are running. Many of them support the SHOW TABLEScommand.

取决于您正在运行的数据库类型。其中许多支持SHOW TABLES命令。