复选框不使用null

时间:2017-03-29 17:39:43

标签: ms-access access-vba ms-access-2010

我正在使用带有Null,N,Y字段的复选框,它似乎不起作用。我似乎无法取消选中它。这是我的代码,任何帮助都提前谢谢。此外,beforeupdate永远不会触发

Private Sub Chk_Complete_BeforeUpdate(Cancel As Integer)
MsgBox Chk_Complete.Value
End Sub

Private Sub Chk_Complete_Click()
Dim FieldValue  As String
''
Me.Chk_Complete.ControlSource = "Complete"
FieldValue = ""
If Me.Chk_Complete.ControlSource = "" Then
    End
End If
'
'If IsNull(Me.Chk_Complete.Value) Then
'Else
    FieldValue = Me.Chk_Complete.Value
'End If
'
Me.Chk_Complete.ControlSource = ""
Select Case FieldValue
Case "N"
Me.Chk_Complete = 0
Case "Y"
Me.Chk_Complete = -1
Case Null
Me.Chk_Complete = 0
End Select
'Me.Chk_Complete = FieldValue
End Sub

Private Sub Chk_Complete_GotFocus()

Dim FieldValue  As String

''
Me.Chk_Complete.ControlSource = "Complete"
FieldValue = ""
If Me.Chk_Complete.ControlSource = "" Then
    End
End If
'
'If IsNull(Me.Chk_Complete.Value) Then
'Else
   FieldValue = Me.Chk_Complete.Value
'End If
Me.Chk_Complete.ControlSource = ""
Me.Chk_Complete = FieldValue
End Sub

0 个答案:

没有答案