我的代码中的If语句有什么问题?

时间:2017-05-16 07:37:15

标签: vba ms-access

这是我早期问题的延续: MS Access subform not displaying records and not navigating

此代码中的if语句似乎有问题,因为没有它的按钮功能。它导致我的子表单“冻结”/停止导航。我解释了在前面提到的线程中使用的语句以及我的子表单会发生什么。

Private Sub btnNextRecord_Click()
On Error GoTo btnNextRecord_Click_Err

If (IsNull(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

DoCmd.GoToRecord , "", acNext

btnNextRecord_Click_Exit:
Exit Sub

btnNextRecord_Click_Err:
MsgBox Error$
Resume btnNextRecord_Click_Exit

End Sub

0 个答案:

没有答案