我的Access数据库有一个查询,我怀疑它是由宏或其他查询调用的。有没有办法在所有宏和/或查询的“代码”上运行查找,以查找文本字符串(在本例中为查询名称)?
答案 0 :(得分:1)
这列出了所有表格和查询:
SELECT IIf([type] = 5, "Query", "Table") AS [Object type]
,MSysQueries.Flag AS [Query type]
,MSysObjects.NAME
,MSysObjects.Id
,MSysObjects.Type
FROM MSysObjects
LEFT JOIN MSysQueries ON MSysObjects.Id = MSysQueries.ObjectId
GROUP BY IIf([type] = 5, "Query", "Table")
,MSysQueries.Flag
,MSysObjects.NAME
,MSysObjects.Id
,MSysObjects.Type
HAVING (
(
(MSysObjects.NAME) NOT LIKE "~*"
AND (MSysObjects.NAME) NOT LIKE "Msys*"
)
AND (
(MSysObjects.Type) = 1
OR (MSysObjects.Type) = 4
OR (MSysObjects.Type) = 6
OR (MSysObjects.Type) = 5
)
)
ORDER BY IIf([type] = 5, "Query", "Table") DESC
,MSysQueries.Flag
,MSysObjects.NAME;
,这个列出了每个对象和引用它的查询:
SELECT [~MSys Tables & Queries].NAME AS [Object]
,MSysObjects.NAME AS [Used in query]
FROM [~MSys Tables & Queries]
LEFT JOIN (
MSysQueries LEFT JOIN MSysObjects ON MSysQueries.ObjectId = MSysObjects.Id
) ON [~MSys Tables & Queries].NAME = MSysQueries.Name1
GROUP BY [~MSys Tables & Queries].NAME
,MSysObjects.NAME
ORDER BY [~MSys Tables & Queries].NAME
,MSysObjects.NAME;
我不知道如何以相同的方式搜索宏。另外,我不确定这总是会选择Union查询中使用的对象。
我希望它给你一个开始的地方。
答案 1 :(得分:0)
您可以安装免费的Access Add-in Access Dependency Checker,它可以通过所有对象搜索字符串。