vba MS Access 错误 2424 找不到对象
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17600735/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
MS Access error 2424 Cannot find object
提问by MrGibbage
I have what looks like a very straightforward line of VBA code that is really messing with my head.
我有一行看起来非常简单的 VBA 代码,这让我很困惑。
id = Form_frm2013_Browser.tb_LineItem_ID.value
When my code reaches this point, I get the following error:
当我的代码到达这一点时,我收到以下错误:
Run-time error '2424': The expression you entered has a field, control, or property name that Microsoft Access can't find
运行时错误“2424”:您输入的表达式具有 Microsoft Access 找不到的字段、控件或属性名称
I am pretty sure the problem is the lower-case "v" in value. When I use the intellisense code completion, the property "Value" comes up as upper case, but when I press enter, it goes to lower case. Of course manually attempting to change it doesn't work either--it just goes back to lower case.
我很确定问题是值中的小写“v”。当我使用智能感知代码完成时,属性“Value”以大写形式出现,但当我按 Enter 时,它变为小写。当然,手动尝试更改它也不起作用——它只是回到小写。
By the way, tb_LineItem_ID is the name of a text box control.
顺便说一下,tb_LineItem_ID 是文本框控件的名称。
Any idea what is going on here?
知道这里发生了什么吗?
回答by HansUp
Access is complaining it can't find something when you ask for the value of a text box. I can't spot anything wrong in that code line, but sometimes it can be helpful to ask for what you want in a different way.
Access 抱怨当您询问文本框的值时找不到某些内容。我无法在该代码行中发现任何错误,但有时以不同的方式询问您想要的内容会有所帮助。
With frm2013_Browser
open in Form View, go to the Immediate window (Ctrl+g), and see what you get with this statement.
随着frm2013_Browser
窗体视图中打开,请立即窗口(Ctrl+ g),看你这个说法得到了什么。
Debug.Print Forms!frm2013_Browser!tb_LineItem_ID.value