MS Access子窗体不显示记录也不导航 [英] MS Access subform not displaying records and not navigating
问题描述
我在SLD表和ORDER表之间具有一对一的关系. SLD表是主窗体,ORDER表是子窗体.主窗体的表比子窗体表具有更多的记录.设置了主链接和子链接.我已经反编译并完成了压缩和修复.我怀疑我的应用程序有故障.在那种情况下,这不是第一次(我之前已经修复过).这次似乎没有任何反应.我还导入了一个新数据库.
I have a one-to-one relationship between an SLD table and an ORDER table. The SLD table is the main form, ORDER table is the subform. The main form's table has more records than the subform table. Master and child links are set. I have decompiled and have done compact and repair. I suspect my application is malfunctioning. In that case it is not the first time (I have fixed it before). Nothing seems to be working this time. I have also imported into a new database.
在表单加载中,表单和字段都可以正常工作.我使用['NEXT']按钮继续下一条记录,并到达子窗体记录的末尾,因此有空白字段.我尝试导航到以前的记录(也使用按钮),但是子窗体不会移动/导航.子表单什么都没有发生.
On form-load both forms and fields are working fine. I continue to the next records using a ['NEXT'] button and reach the end of the sub-forms records therefore having blanks fields. I try to navigate to the previous records (also using a button) but the subform does not move/navigate. Nothing happens to the subform.
似乎情况变得更糟,因为首先是在导航,但是它没有遵循代码,即文本框被填充时禁用复选框,反之亦然.
It seems like it has gotten worse because first it was navigating but it was not obeying code saying when text box is filled disable checkbox and vise versa.
推荐答案
我发现If语句属于Form_Current事件.这段代码之后,我不再遇到问题了:
I found out that the If statement belonged in Form_Current event. I am not experiencing the problem anymore after this code:
Private Sub Form_Current()
If (IsNull(Forms!Order!OrderSubform.Form!txtOrder_Number.Value) Or _
Forms!Order!OrderSubform.Form!txtOrder_Number.Value = "") Then
Forms!Order!OrderSubform.Form!txtDate_Of_Order.Enabled = True
Forms!Order!OrderSubform.Form!chkbxOrder_Cancelled.Enabled = True
ElseIf (IsNull(Forms!Order!OrderSubform.Form!txtDate_Of_Order.Value) Or _
Forms!Order!OrderSubform.Form!txtDate_Of_Order.Value = "") Then
Forms!Order!OrderSubform.Form!txtDate_Of_Order.Enabled = False
Forms!Order!OrderSubform.Form!chkbxOrder_Cancelled.Enabled = True
Forms!Order!OrderSubform.Form!chkbxOrder_Cancelled.Value = True
Else
Forms!Order!OrderSubform.Form!txtDate_Of_Order.Enabled = True
Forms!Order!OrderSubform.Form!chkbxOrder_Cancelled.Enabled = False
Forms!Order!OrderSubform.Form!chkbxOrder_Cancelled.Value = False
End If
End Sub
这篇关于MS Access子窗体不显示记录也不导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!