出现错误3048:无法打开任何其他数据库 [英] Getting Error 3048: Cannot open any more databases

查看:271
本文介绍了出现错误3048:无法打开任何其他数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近拆分了我的数据库。我的表单是带有 Tab 的日历,分别用于月视图,周视图和日视图,分别具有42、7和7个子表单。所有这些子表单都是未绑定的。选择一个选项卡后,该选项卡中的所有子窗体都被分配一个 ControlSource ,而所有其他子窗体都被清除了 ControlSource

I recently split my database. My form is a calendar with a Tab for Month View, Week View, and Day View with 42, 7, and 7 subforms, respectively. All of these subforms are unbound. When a tab is selected, all the subforms in that tab is assigned a ControlSource while all other subforms are cleared of its ControlSource.

月视图是唯一出现错误3048:无法再打开任何数据库的视图。加载23个子表单( Tab 外面有一些标签,列表和按钮,但我认为它们并不重要)。

The Month View is the only one that gets Error 3048: Cannot open any more databases. after it loads 23 subforms (there are a few labels, lists, and buttons outside the Tab, but I do not think they are significant).

选择月份视图选项卡时,将发生以下操作:

When the Month View tab is selected, the following actions occur:


  1. 42x2数组填充为日期信息

  2. 清除所有子窗体的 SourceObject

  3. 对于选定选项卡中的所有子表单:分配其 SourceObject ,然后调用一个函数(位于SUBform中)以 Filter 本身。在此函数中,将调用另一个函数以根据某些条件对子表单中的记录数进行计数。在此处创建数据库和记录集,并在记录集 Closed 关闭之前经过几次。

  1. A 42x2 array is filled with Long date information
  2. All subforms are cleared of its SourceObject
  3. For all subforms in the selected tab: Assign its SourceObject then call a function (located in the SUBform) to Filter itself. In this function, another function is called to count the number of records in the subform based on some criteria. A database and recordset is created here and passed through several times before the recordset is Closed.

子窗体包含多个文本框,其中一个包含用于为其着色的条件格式。它的记录源是查询:

The Subform contains several text boxes with one containing a conditional format to color it. Its Record Source is the query:

SELECT tblTask.JobNum, tblJob.JobNum, tblTask.Sequence, tblJob.Closed, tblJob.Certified, tblEstimator.SortID, tblDivision.SortID, tblJob.EstimatorID, tblTask.DivisionID, tblJob.JobSite, tblJob.Customer, tblJob.Closed, tblTask.Item, tblTask.ItemDescription, tblTask.StartDate, tblTask.EndDate, tblTask.WeekendWork, tblEstimator.EstimatorNum & "-" & [FirstName] & " " & [LastName] & "\20" & Mid([tblJob].JobNum,3,2) & " JOBS\" AS JobMidFilePath
FROM (tblEstimator RIGHT JOIN tblJob ON tblEstimator.ID = tblJob.EstimatorID) RIGHT JOIN (tblDivision RIGHT JOIN tblTask ON tblDivision.ID = tblTask.DivisionID) ON tblJob.JobNum = tblTask.JobNum
WHERE (((tblJob.Closed)=False))
ORDER BY tblTask.JobNum, tblTask.Sequence, tblTask.StartDate, tblDivision.SortID;

现在此查询返回521条记录。

Right now 521 records are returned with this query.

是否期望我的表格不能处理所有这些?还是有办法提高表格的效率?我对于该怎么办感到很迷茫,因为我需要加载全部42个子表单。

Is it expected that my form should not be able to handle all of this? Or is there a way to improve the efficiency of my form? I'm very lost about what I should do about this, since I need all 42 subforms to load.

让我知道您是否需要更多信息。

Let me know if you need more information. Thanks in advance!

推荐答案

所以,好消息是您的问题月份视图选项卡都是只读的。这将使实施我的建议更容易:

So, the good news is your problem month view tab is all read-only. That will make it easier to implement my suggestions:


  1. 尝试在每个表单属性的记录属性中将RecordsetType设置为 Snapshot您的子表单。这是最简单的。如果那不起作用,请尝试:

  1. Try setting the RecordsetType to 'Snapshot' in the Form Properties for each of your subforms. This is simplest. If that doesn't work, try:

使用ADO断开连接的记录集。查看此引用:

Use ADO disconnected recordsets. Look at this reference:

如何在VBA / C ++ / Java中创建ADO断开记录集

基本上,您可以创建此断开记录集,并为其设置子窗体的.RecordSet属性:

Basically, you create this disconnected recordset thingy, and set the .RecordSet propery of your subform to it:

Set mySubForm.Recordset = myDisconnectedRsObject

由于按照定义这些都不维护与后端的连接,因此您应该能够在不增加数据库的情况下创建任意数量的数据库

Since these by definition do not maintain a connection to the backend, you should be able to create as many as you like without increasing the database count.

一旦第一个工作,您将需要将所有基于42个子表单的Access / Jet查询转换为断开连接的记录集。

Once you get the first one working, you will need to convert all of your Access/Jet queries underlying the 42 subforms into disconnected recordsets.

这篇关于出现错误3048:无法打开任何其他数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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