重新查询子窗体的Visual Basic [英] Requery Subform Visual Basic
问题描述
我只是想知道,如果有人可以帮助我的子窗体不requering。我的目的是,一旦一个记录添加到我的子窗体,我不应该推全部刷新按钮,我希望它会自动刷新。我曾尝试以下编码的主要形式插入后,并在子窗体,但没有奏效。如果有人对如何做到这一点除了我尝试过程中的任何其他的想法,那将是巨大的,谢谢你。
创作是表的名称。
私人小组Form_AfterUpdate()
表格![创作] .Requery
结束小组
和
私人小组Form_AfterUpdate
DoCmd.Close acForm,创作,acSaveNo
DoCmd.OpenForm创作
结束小组
如果您通过添加code的记录,重新查询应该在添加记录的过程。大多数事件不是由编程的数据更改触发。
有关子窗体中的code运行:
Me.Requery
主要形式有:
Me.Subformcontrolname.Form.Requery
在其他地方
表格!Mainformname.Subformcontrolname.Form.Requery
I was just wondering if somebody could help with my subform not requering. My aim is that once a record is added in to my subform, I shouldn't have to push the 'Refresh All' button, I want it to refresh automatically. I have tried the following coding on After Insert of the Main Form, and on the Subform, but it hasn't worked. If anybody has any other ideas of how to do so apart from the way I tried, that would be great, thank you.
Creations is the name of the Form.
Private Sub Form_AfterUpdate()
Form![Creations].Requery
End Sub
and
Private Sub Form_AfterUpdate
DoCmd.Close acForm, "Creations", acSaveNo
DoCmd.OpenForm "Creations
End Sub
If you are adding records via code, the requery should go in the procedure that adds the records. Most events are not triggered by programmatic changes to data.
For code running in the subform:
Me.Requery
The main form:
Me.Subformcontrolname.Form.Requery
Elsewhere
Forms!Mainformname.Subformcontrolname.Form.Requery
这篇关于重新查询子窗体的Visual Basic的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!