显示现有记录的子窗体不会显示新记录 [英] Subform displaying existing record won't display new record

查看:73
本文介绍了显示现有记录的子窗体不会显示新记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个子表单绑定到一个查询,该查询将使用父表单中列表框提供的ID#显示记录。


同样的子表单也用于创建在新记录中使用以下代码的新记录commandbutton:

I have a subform which is bound to a query which will display records using an ID# supplied from a listbox in the parent form.

That same subform is also used to create new records using the following code in a "New Record" commandbutton:

展开 | 选择 | Wrap | 行号

推荐答案

如果你的按钮是从主表单执行的,我相信你必须设置焦点在子窗体上以执行子窗体的新记录命令。

以这种方式尝试您的代码:
If your button is executing from the main form, I believe you have to set focus on the subform to execute the new record command for the subform.
Try your code this way:
展开 | 选择 | Wrap | 行号


感谢您的建议,puppydogbuddy。我试过了,但是我收到以下错误:


运行时错误''2449'':表达式中有一个无效的方法。


它突出显示带有SetFocus的行。形式的方法。我为SetFocus尝试了各种方法,但它们都以同样的错误结束。


知道为什么吗?


感谢您的帮助!
Thanks for the suggestion, puppydogbuddy. I tried it, but I get the following error:

Run-time error ''2449'': There is an invalid method in an expression.

It highlights the line with the "SetFocus" method for the form. I tried various approaches for the SetFocus, but they all end in the same error.

Any idea why?

Thanks for your help!


oops,我忘了将焦点设置在子窗体源对象(嵌入在子窗体控件中的窗体)上的控件上。


看到这个链接:如何在Access 2002中使用setFocus方法选择子窗体上的控件
oops, I forgot to set focus on a control on the subform source object(the form embedded in the subform control).

See this link: How to select controls on a subform with setFocus method in Access 2002
展开 | 选择 | Wrap | 行号


这篇关于显示现有记录的子窗体不会显示新记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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