更改查询时 MS Access 溢出

发布于 2024-12-03 22:14:59 字数 356 浏览 1 评论 0原文

好的,我已经在 MS Access 2007 中构建了报告,每个报告都运行多个(40 多个)查询。查询正在打开表、子查询等,我不认为 Access 正在关闭它们。我可能是错的,但出于某种原因,我认为这是导致溢出的原因。

但无论如何,我试图弄清楚为什么会突然发生这种情况,以及我能做些什么来解决它。当我只有一个模式和一些虚拟数据时,报告工作得很好,但是当数据库实际填充时,为我们提供数据的个人创建了更多的查找表,所以现在使用 3 个表的典型查询是使用 5。

您认为查找表的增加(因此 Access 打开更多对象)是我收到溢出错误的原因,还是可能是其他原因?另外,我不懂VBA,那么是否有任何值得追求的简单解决方案(例如分解报告,这需要一段时间)?

谢谢

Okay, I have built reports in MS Access 2007, and each report runs off of several (40+) queries. The queries are opening tables, subqueries, etc, and I don't think Access is closing them. I could be wrong, but for some reason I think this is causing the overflow.

But anyways, I am trying to figure out why it is happening all of a sudden, and what I can do to resolve it. I had the reports working fine when I just had a schema and some dummy data, but when the database was actually populated, the individuals who gave us the data created a few more look up tables, so now a typical query using 3 tables is now using 5.

Do you think this increase in look up tables (and therefore more objects being opened by Access) is the reason I am getting overflow errors, or could it be something else? Also, I don't know VBA, so are there any simple solutions (e.g. breaking up the reports, which would take a while) that would be worth pursuing?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南冥有猫 2024-12-10 22:14:59

确保您真正了解自己的“溢出”状况。此代码在立即窗口中显示“错误 6(溢出)”(不带引号)。

    Dim i As Integer
    Dim strMsg As String

On Error GoTo ErrorHandler

    i = 32767
    i = i + 1

ExitHere:
    On Error GoTo 0
    Exit Sub

ErrorHandler:
    strMsg = "Error " & Err.Number & " (" & Err.description _
        & ")"
    Debug.Print strMsg
    GoTo ExitHere

该错误的解释是 32,767 是 VBA Integer 可以接受的最大值。因此,尝试加 1 会得到 32,768,这比整数所能容纳的要大……所以会溢出。

其他数字数据类型也有限制。例如,2147483647 是可以存储为 VBA Long 的最大值。

我在这里可能完全没有根据,但我会检查您的复杂报告是否包括排序和分组选项,您可能会在其中生成总计。如果是这样,您添加的数据是否使这些总计的值超出了各自数据类型的容量。

如果您收到包含“溢出”一词的其他错误消息,则告诉我们错误消息的确切文本可能会有所帮助。

Make sure you really understand your "overflow" condition. This code displays "Error 6 (Overflow)", without the quotes, in the Immediate Window.

    Dim i As Integer
    Dim strMsg As String

On Error GoTo ErrorHandler

    i = 32767
    i = i + 1

ExitHere:
    On Error GoTo 0
    Exit Sub

ErrorHandler:
    strMsg = "Error " & Err.Number & " (" & Err.description _
        & ")"
    Debug.Print strMsg
    GoTo ExitHere

The explanation for that error is that 32,767 is the maximum value a VBA Integer can accept. So, attempting to add one would give 32,768 which is greater than an Integer can hold ... so overflow.

Other numeric data type also have limits. For example, 2147483647 is the maximum value which can be stored as a VBA Long.

I might be totally off base here, but I would check whether your complex report includes sorting and grouping options where perhaps you produce totals. And if so, whether the data you added pushes the values for any of those totals beyond the capacity of their respective data types.

If you're getting a different error message which includes the word "overflow", it might help to tell us the exact text of the error message.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文