MS Access VBA 对象需要错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13934473/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 18:53:06  来源:igfitidea点击:

MS Access VBA Object Required Error

vbams-access

提问by user1706975

Dim maker as String
Set Maker = Forms![A]![B]

I can't seem to get this to work. Every time it runs, it gives me an "object required" error. This is contained within a greater module, but this is the only aspect of it that is giving me a problem.

我似乎无法让它发挥作用。每次运行时,它都会给我一个“需要对象”的错误。这包含在一个更大的模块中,但这是它给我带来问题的唯一方面。

Basically, I want "maker" to be equivalent to the contents of a text box named B on form A.

基本上,我希望“maker”相当于表单 A 上名为 B 的文本框的内容。

Any suggestions?

有什么建议?

回答by Fionnuala

Do not use Set unless you are assigning an object:

除非您要分配对象,否则不要使用 Set:

Dim maker as String
Maker = Forms![A]![B]

For an object:

对于一个对象:

Dim maker as Form
Set Maker = Forms![A]