子表单重新查询问题 [英] Subform requery problem
问题描述
大家好,
我最近在我的表格(frmRota)上改写了日历的onClick程序。它从tblRotas打开记录,其中字段rDate等于在Calendar上选择的字段。如果这样的记录不存在,我希望它被创建。之前只有创建新记录的方法是单击我使用Access2003按钮向导创建的NewRecord按钮。 Calendar没有绑定到recordsource中的任何字段,但是在这个表单上我有文本框rDate绑定到tblRota.rDate字段,我在onClick过程结束时更新。记录存在时一切正常 - 但是当我尝试通过点击我的表中没有相应记录的日期创建新记录(tblRotas)时,在附加到frmRota表单的子表单上填充组合框时会出现错误。错误是:您输入的表达式对属性表单/报表具有无效引用。
我区分产生错误的行。
我知道我的解释可能有点令人困惑我在Access DB编程中几乎是新手所以请原谅我不是最好的vb代码。以下是附加到frmRota的所有代码:
尝试以下语法:
Me!sfrmRota.Form!Item(2).Requery
试试这个语法:
我!sfrmRota.Form!项目(2).Requery
谢谢,但不幸的是,这没有任何帮助。
谢谢,但不幸的是,这没有用。
请提供一些细节.......我不是坐在你的电脑上......会发生什么.....是什么错误信息?
Hi guys,
I recently rewrote onClick procedure for Calendar on my form (frmRota). It opens record from tblRotas where field rDate is equal the one selected on Calendar. If such a record doesnt exist I want it to be created. Before only way to create new record was to click on NewRecord button that I created using Access2003 button wizard. Calendar is not bound to any field in recordsource but on this form I have text box rDate that is bound to tblRota.rDate field which I update at the end of onClick procedure. Everything is ok when record exists - but when I try to create new record by clicking on Date that doesnt have corresponding record in my table (tblRotas) I get an error when populating combobox on subform attached to the frmRota form. Error is : "You entered an expression that has an invalid reference to the property Form/Report."
I distinguished the line that produces the error.
I know that my explanation might be a bit confusing I am pretty much novice in Access DB programming so please excuse me not the best vb code. Here is all the code attached to frmRota:
try this syntax:
Me!sfrmRota.Form!Item(2).Requery
try this syntax:
Me!sfrmRota.Form!Item(2).RequeryThanks but unfortuantely this doesn''t help.
Thanks but unfortuantely this doesn''t help.Please provide some details.......I am not sitting at your computer....what happens.....what is the error message ?
这篇关于子表单重新查询问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!