我在SLD表和ORDER表之间有一对一的关系。 SLD表是主窗体,ORDER表是子窗体。 主窗体的表具有比子窗体表更多的记录。 主链接和子链接已设置。 我已反编译并完成了紧凑和修复。 我怀疑我的应用程序出现故障。 在这种情况下,这不是第一次(我之前已经修复过)。 这一次似乎没有任何工作。 我也已经导入到一个新的数据库中。
在表单加载这两种形式和领域工作正常。 我使用['NEXT']按钮继续下一个记录,并到达子表单记录的末尾,因此具有空白字段。 我尝试导航到以前的记录(也使用按钮),但子窗体不移动/导航。 子表单没有任何反应。
看起来它变得更糟,因为它首先是导航,但它没有遵从代码说当文本框被填充禁用复选框,反之亦然。
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.
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.
最满意答案
从它的声音中,问题出在你的Next按钮上,而不是它是一个子窗体问题。 正如您在评论中所述,默认导航允许表单按预期工作。
您的上一个按钮OnClick事件中是否存在此逻辑? 为了安全起见,我还要在下面的代码中添加OR语句,以确保它的捕获空值或空格
If (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 IfI 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更多推荐
发布评论