找不到引用的形式找不到、形式

2023-09-08 11:21:07 作者:生死皆闲事

当我点击创建新表下面的按钮,我得到以下运行时错误2450对话框:

When I click on the Create New Form button below, I get the following runtime error 2450 dialog box:

当我点击调试按钮,它给了我如下:

When I click on the debug button, it gives me the following:

主要形式被称为FindClientsNavigation。在ListOfForms窗体创建新表按钮被认为导致NavigationSubForm更换ListOfForms用新CommunicationForm形成,使得用户可以从用于与特定客户机ID的客户端的新形式是,可以在输入信息txtClientID文本框,您可以在FindClientsNavigation形式的顶部看到我的第一个图像上方。

The main form is called FindClientsNavigation. The "Create New Form" button in the ListOfForms subform is supposed to cause the NavigationSubForm to replace the ListOfForms form with a new CommunicationForm so that the user can enter information from a new form for the Client with the specific Client ID that is available in the txtClientID textbox, which you can see in the top of the FindClientsNavigation form in my first image above.

我如何改变code以上,以便它加载在NavigationSubForm新CommunicationForm?以及如何获得新的CommunicationForm有存储在其中的客户端ID,以便提交表单将允许的形式加以保存,参照具体的ClientID?

How do I alter the code above so that it loads a new CommunicationForm in the NavigationSubForm? And how do I get that new CommunicationForm to have the ClientID stored in it, so that submitting the form will allow the form to be saved with reference to the specific ClientID?

推荐答案

该SourceObject需要设置为一个字符串,它是用表格的名称:

The SourceObject needs to be set to a string, which is the name of the form to use:

.SourceObject = "CommunicationForm"

[注意是表格是打开的形式集合,所以你不能用它来指一种形式在导航窗格中 - 除非你知道,这种形式是开放]

[Note that Forms is the collection of open forms so you cannot use this to refer to a form in the Navigation Pane - unless you know that this form is open.]

您可以使用客户端ID(主窗体上)这个子窗体,但也有许多方法可以做到这一点,这取决于您的具体要求:

You can use the Client ID (on the main form) for this subform, but there are a number of ways to do this and it depends on your specific requirement:

在子窗体可以基于这指的是主窗体上的文本框(也许 txtClientID )的查询。这是比较简单的方法之一。 您可以动态地设置记录源的子窗体,使用WHERE子句,指的是客户端ID(类似于上面的方法)。 您可以申请一个过滤器子窗体,因此它仅显示该客户端ID的单条记录。 The subform could be based on a query that refers to the textbox (perhaps txtClientID) on the main form. This is one of the simpler approaches. You could dynamically set the RecordSource for the subform, using a WHERE clause that refers to the Client ID (similar to the above approach). You could apply a Filter to the subform, so that it only displays the single record for the Client ID.