为什么NewRecord属性对我说谎? [英] Why is the NewRecord property lying to me?

查看:86
本文介绍了为什么NewRecord属性对我说谎?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我完全不知所措,一种形式改变了我的行为;它正在工作,然后没有明显原因就停止了.我从一个按钮打开它:

I'm at a complete loss, a form just changed behavior on me; it was working and then just stopped for no apparent reason. I'm opening it from a button:

DoCmd.openForm "formName", , , "ID=" & Me.ID

调试跟踪显示此时已正确设置该值.加载表单时,我需要使用OnCurrent事件设置一些显示项.

Debug tracing shows that the value is set properly at this point. When the form loads, I need to set a few display items, using the OnCurrent event.

Private sub Form_Current()
    if Me.NewRecord Then

到那时,它说没有记录,调试信息说记录集是BOF和EOF,就好像查询不匹配一样.但是,如果我此时运行已保存的查询,它将显示正确的信息.此外,如果我停止执行,将表单保持打开状态,然后再次单击按钮,它会确实正确加载数据.我很困惑.

At that point, it says there's no record, debugging info says the recordset is BOF and EOF, as if the query didn't match. But if I run the saved query at that moment, it displays the right info. Furthermore, if I stop the execution, leaving the form open, and then hit the button again, it does load the data properly. I'm stumped.

编辑-从备份导入表单并重新输入更改后,整个问题就消失了.我正在猜测腐败,但是如何将其破坏却是一个谜.

Edit - After importing the form from a backup, and retyping the changes, the whole problem went away. I'm guessing corruption, but it's a mystery how it can screw up like that.

推荐答案

重命名有问题的表单,然后从备份导入该表单以修复该问题.如果您需要扫描自备份以来的更改,重命名是明智的.

Renaming the problem form, and then importing the form from backup fixed it. Renaming is wise if you need to scan for changes since the backup.

感谢Remou,我也忘记了/decompile选项,这可能已经解决了.

Thanks Remou, I had forgotten about the /decompile option too, that might have fixed it.

在回答问题时,我还应该补充一点:永远不要在网络上的同一台计算机或多台计算机上运行前端表单的两个副本...拆分数据,并确保每个前端进程都具有它自己的前端副本.我认为这导致了表单损坏.

While I'm answering the question, I should also add: Never run two copies of the frontend forms, whether on the same computer or multiple computers across the network... split your data, and make sure each frontend process has its own copy of the frontend. I think that contributed to the form corruption.

这篇关于为什么NewRecord属性对我说谎?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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