除了“查询"之外,在 Microsoft Access 数据库中还可以在哪里找到查询? [英] Where can a query be found in a Microsoft Access database besides "Queries"?

查看:43
本文介绍了除了“查询"之外,在 Microsoft Access 数据库中还可以在哪里找到查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我特别了解了一些关于数据库和 Microsoft Access 的知识,试图帮助维护一个 Microsoft Office Access 2003 数据库,其中包含由几个不再在公司工作的人建立的 Visual Basic 脚本(版本 6.5).现在我们遇到的问题是,我们从外部来源获取的数据无法再被数据库脚本导入;格式发生了一些变化,但我们无法弄清楚是什么.

So I have learned a bit about databases and Microsoft Access specifically, trying to help maintain a Microsoft Office Access 2003 database with Visual Basic scripting (version 6.5) which was set up by several people who are no longer with the company. Now we have the problem that the data we're getting from an outside source can no longer be imported by the database scripts; something about the format has changed but we can't figure out what.

我正在尝试深入研究脚本,以找出发生了哪些变化,以及什么可能是让事情重新工作的最佳解决方案.我们已经稍微缩小了问题的范围;它位于此代码段的最后一行:

I'm trying to dig into the scripting to figure out what's changed and what might be the optimal solution for getting things working again. We've narrowed down the problem somewhat; it's in the last line in this code snippet:

Debug.Print "step #255"
DoCmd.OpenQuery "qryMAKE NEW GHR TABLE", acNormal, acEdit

Debug.Print "step #256"
DoCmd.OpenQuery "qryUPDATE MIDDLE INI", acNormal, acEdit

Debug.Print "step #257"
DoCmd.OpenQuery "qryUPDATE SUFFIX", acNormal, acEdit

现在,这是让我完全困惑的部分!当我打开数据库时,我看到对话框让我可以选择查看表格"、查询"、报告"、表单"等.我假设数据库中的所有查询都可以找到在查询"部分下.但是在上述代码片段中调用的三个查询中,实际上只有 qryMAKE NEW GHR TABLE 存在.另外两个肯定行动就好像它们存在一样 - 调试输出打印步骤#256",步骤#257"并且在两者之间没有抱怨无法找到qryUPDATE MIDDLEINI - 但我找不到这个查询或 qryUPDATE SUFFIX.

Now, here's the part that has me completely confused! When I open up the database, I see the dialog that gives me an option of looking at "Tables", "Queries", "Reports", "Forms", etc. I would have assumed that all queries in a database would be findable under the "Queries" section. But of the three queries that are called in the above code snippet, only qryMAKE NEW GHR TABLE is actually there. The other two certainly act as if they exist - the debug output prints "step #256", "step #257" and doesn't complain in between about not being able to find qryUPDATE MIDDLE INI - but I cannot find this query or qryUPDATE SUFFIX.

关于可能发生的事情,我唯一能想到的是,Microsoft 的文档说它会在数据库本身中查找查询,但也可能会在库数据库"中查找.不幸的是,我似乎找不到关于什么是图书馆数据库"的任何信息,当然不足以确定我们是否正在使用;尝试在图书馆数据库"上搜索只会显示有关图书馆正在使用和借出图书馆使用的数据库的结果.

The only thing I've been able to figure about what might be happening is that Microsoft's documentation says that it looks for queries in the database itself but might also look in a "library database". Unfortunately, I can't seem to find any information on what "library databases" are, certainly not enough to figure out if we're using one; trying to search on "library database" only brings up results about databases being used in and by lending libraries.

我们需要在哪里寻找qryUPDATE MIDDLE INIqryUPDATE SUFFIX?

Where do we need to look for qryUPDATE MIDDLE INI and qryUPDATE SUFFIX?

推荐答案

如果查询在当前数据库中,您应该能够在 QueryDefs 集合中看到它.按 Ctrl-G 转到 VBE 中的立即窗口并输入;

If the query is in the current database, you should be able to see it in the QueryDefs collection. Hit Ctrl-G to go to the Immediate Window in the VBE and type this;

  ?CurrentDB.QueryDefs("qryUPDATE MIDDLE INI").Name

如果它返回 qryUPDATE MIDDLE INI" 那么它就在那里,只是不一定可见.要查找,请键入:

If it returns qryUPDATE MIDDLE INI" then it's there, just not necessarily visible. To find out, type this:

  ?GetHiddenAttribute(acQuery,"qryUPDATE MIDDLE INI")

如果设置为隐藏,则返回 True,然后您可以更改访问选项以显示隐藏的对象.

That will return True if it's been set to be hidden, an then you can change your Access options to display hidden objects.

这篇关于除了“查询"之外,在 Microsoft Access 数据库中还可以在哪里找到查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆