On Load记录集代码期间出错 [英] Error during On Load recordset code

查看:49
本文介绍了On Load记录集代码期间出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。


请帮我解决这个错误,我不知道为什么会这样,也许你确实有。我知道这有点长,我已经把它变得最简单,最清晰。


我有一个代码,用于转到中的特定记录表格!frmCustomersByCity!subfrmCustomers.Form!Cust omer_Id 具有特定城市过滤器 Forms!frmCustomersByCity!subfrmCity.Form!City_Id 主要形式 Forms!frmCustomersByCity ,使用绑定文本框和未绑定的组合框值 Forms!frmDistribution!cboCustomer_Id.Value Forms!frmDistribution!cboCity_Id.Value 形式 Forms!frmDistribution 。我不能使用DoCmd.GoToRecord方法,因为它的记录是在子表单上。


这是'它是再次:


从表格中打开:
表格!frmDistribution,

值:表格!frmDistribution!cboCustomer_Id.Value Forms!frmDistribution!cboCityList.Value


要打开的表格:
表格!frmCustomersByCity

转到:
表格!frmCustomersByCity!subfrmCustomers.Form!Cust omer_Id

筛选条件:
表格! frmCustomersByCity!subfrmCity.Form!City_Id


我从frmDistribution使用的代码是:

Hello all.

Please help me with this error, I have no clue why it is happening, maybe you do have. I know this is a bit long, I''ve made it the simpliest and clearest I could.

I have a code that is designed to go to a specific record in Forms!frmCustomersByCity!subfrmCustomers.Form!Cust omer_Id with a specific city filter Forms!frmCustomersByCity!subfrmCity.Form!City_Id that are in main form Forms!frmCustomersByCity, using bound textbox and unbound combo box values Forms!frmDistribution!cboCustomer_Id.Value, Forms!frmDistribution!cboCity_Id.Value of the form Forms!frmDistribution. I can''t use DoCmd.GoToRecord method since it''s the record to be gone to is on a subform.

Here''s is it again:

open from the form:
Forms!frmDistribution,
Values: Forms!frmDistribution!cboCustomer_Id.Value, Forms!frmDistribution!cboCityList.Value

the form to be opened:
Forms!frmCustomersByCity
goto:
Forms!frmCustomersByCity!subfrmCustomers.Form!Cust omer_Id
filter by:
Forms!frmCustomersByCity!subfrmCity.Form!City_Id

the code I''m using from frmDistribution is:

展开 | 选择 | Wrap | 行号

推荐答案


大家好。


请帮我这个错误,我不知道为什么会这样,也许你确实有。我知道这有点长,我已经把它变得最简单,最清晰。


我有一个代码,用于转到中的特定记录表格!frmCustomersByCity!subfrmCustomers.Form!Cust omer_Id 具有特定城市过滤器 Forms!frmCustomersByCity!subfrmCity.Form!City_Id 主要形式 Forms!frmCustomersByCity ,使用绑定文本框和未绑定的组合框值 Forms!filmdistribution!cboCustomer_Id.Value Forms!filmdistribution!society_Id.Value 形式 Forms!filmdistribution 。我不能使用DoCmd.GoToRecord方法,因为它的记录是在子表单上。


这是'它是再次:


从表格中打开:
表格!电影发行,

价值观:表格!电影发行!cboCustomer_Id.Value Forms!filmdistribution!cboCityList.Value


要打开的表格:
表格!frmCustomersByCity

转到:
表格!frmCustomersByCity!subfrmCustomers.Form!Cust omer_Id

筛选条件:
表格! frmCustomersByCity!subfrmCity.Form!City_Id


我在电影发行中使用的代码是:

Hello all.

Please help me with this error, I have no clue why it is happening, maybe you do have. I know this is a bit long, I''ve made it the simplest and clearest I could.

I have a code that is designed to go to a specific record in Forms!frmCustomersByCity!subfrmCustomers.Form!Cust omer_Id with a specific city filter Forms!frmCustomersByCity!subfrmCity.Form!City_Id that are in main form Forms!frmCustomersByCity, using bound textbox and unbound combo box values Forms!filmdistribution!cboCustomer_Id.Value, Forms!filmdistribution!society_Id.Value of the form Forms!filmdistribution. I can''t use DoCmd.GoToRecord method since it''s the record to be gone to is on a subform.

Here''s is it again:

open from the form:
Forms!filmdistribution,
Values: Forms!filmdistribution!cboCustomer_Id.Value, Forms!filmdistribution!cboCityList.Value

the form to be opened:
Forms!frmCustomersByCity
goto:
Forms!frmCustomersByCity!subfrmCustomers.Form!Cust omer_Id
filter by:
Forms!frmCustomersByCity!subfrmCity.Form!City_Id

the code I''m using from filmdistribution is:

展开 | 选择 | Wrap | 行号



它看起来像2种可能性中的一种

__1你的子表格 subfrmCustomers subfrmCustomerst ?两者都在代码中特别引用。如果这只是一个错字然后:
It looks like 1 of 2 possibilities
__1 Is your Sub-Form subfrmCustomers or subfrmCustomerst? Both are specifically referenced in the code. If this is just a typo then:



(这是一个错字,我在这里简化了名字。)

(It was a typo, I simplified names here.)


__2说明如下:
__2 Explanation follows:
展开 | 选择 | Wrap | 行号



(这是一个错字,我简化了这里的名字。)


首先,感谢您对此进行调查。多么酷,你是绝对正确的,这就是问题。


现在我已经把所有与表单过滤相关的事情放在记录集代码和记录集的尺寸之前,它的工作原理很好。


你能解释为什么filteron让rs不再有效吗?
(It was a typo, I simplified names here.)


First, Thanks for looking into this. How cool, you are absolutely right, that is the problem.

Now I''ve put all that is to do with form filtering before the recordset code and recordset dimensioning, and it works fine.

Can you explain why filteron makes rs no longer valid?

注意:如果关闭表单或更改表单的RecordSource属性,则Recordset对象不再有效。如果您随后在窗体或Recordset对象中引用Recordset对象或以前保存的书签,则会发生错误。通过应用过滤器,您实际上是在更改Form的RecordSource属性,而该属性又适用于Recordset Clone。

Note: If you close a form or if you change the form''s RecordSource property, the Recordset object is no longer valid. If you subsequently refer to the Recordset object or to previously saved bookmarks in the form or the Recordset object, an error will occur. By applying a Filter, you are, in essence changing the Form''s RecordSource property which in turn would apply to a Recordset Clone.


这篇关于On Load记录集代码期间出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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