如果打开多个表单,则在关闭数据库时出错 [英] Error when closing database if multiple forms are open

查看:86
本文介绍了如果打开多个表单,则在关闭数据库时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Access Runtime 2010供我的用户使用我的数据库。 frmHome是自动打开的表单的名称。如果我有frmLoans和frmHome打开并单击X关闭程序,我从frmLoans的'OnLoad事件中得到一个错误,说你输入的表达式对属性Form / Report有无效的引用。 (错误号2455)。当我关闭数据库时,为什么任何表单的OnLoad事件都在运行?我应该陷入错误2455并继续下一个错误吗?如果我关闭frmLoans(只留下frmHome打开)然后关闭数据库,那么我不会收到错误。我也没有在我的笔记本电脑上打开frmLoans时出现错误,上面有完整的Access 2010.

解决方案

这听起来很奇怪,我承认不会有很多使用运行时的经验。


但是当听起来非常奇怪时,就像这里的情况一样,首先要尝试的是压缩和修复,反编译,然后重新编译。


现在,如果这不起作用,我们将不得不查看表格关闭时可能发生的任何事件。 unloaded,也许知道你是否使用实例表单可能是相关的?


两个表单都没有任何与它们的结束相关的事件(OnClose,OnUnload等)我做了反编译,重新编译,紧凑和修复,同样的错误。不确定实例表单是什么,所以很可能我没有使用它们。


如果您使用的代码如下:

展开 | 选择 | Wrap | 行号< /跨度>

I''m using Access Runtime 2010 for my users to use my database. frmHome is the name of the form that opens automatically. If I have frmLoans and frmHome open and click the X to close the program, I get an error from frmLoans'' OnLoad event saying that "You entered an expression that has an invalid reference to the property Form/Report." (error number 2455). Why is any form''s OnLoad event running when I''m closing the database? Should I just trap for error 2455 and resume next for just that error? If I close frmLoans (leaving just frmHome open) and then close the database, then I don''t get the error. I also don''t get the error with frmLoans open on my laptop that has the full Access 2010 on it.

解决方案

This sounds very weird and I admit to not having to much experience with using just runtime.

However when something sounds very weird, as is the case here, the first thing to try is to compact&Repair, Decompile, and then recompile.


Now if that doesn''t work we would have to look into any events that might run when the form is closed & unloaded, and perhaps it might be relevant to know if you use instanced forms?


Neither form has any events related to their closing (OnClose, OnUnload, etc.) I did the decompile, recompile, compact and repair, same error. Not sure what an instanced form is, so chances are I''m not using them.


If you are using code like:

Expand|Select|Wrap|Line Numbers


这篇关于如果打开多个表单,则在关闭数据库时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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