使用Access VBA中的复选框功能时出现438运行时错误

时间:2017-02-10 13:44:04

标签: ms-access access-vba

使用Access 2007表单上的复选框时出现438运行时错误:'对象不支持此属性或方法'。出了什么问题以及如何解决这个问题?

enter image description here     Private Sub Command133_Click()     'On Error GoTo ErrHandle

' Save the Current Record
If Me.Dirty Then Me.Dirty = False

' Exit the procedure if appointment has been added to Outlook.
If Me.chkAddedToOutlook = True Then
    MsgBox "This appointment has already added to Microsoft Outlook.", vbCritical
    Exit Sub
Else
End If
End Sub

3 个答案:

答案 0 :(得分:0)

您可能需要更加具体:

If Me!chkAddedToOutlook.Value = True Then

编辑:

'    ' Exit the procedure if appointment has been added to Outlook.
'    If Me.chkAddedToOutlook = True Then
'        MsgBox "This appointment has already added to Microsoft Outlook.", vbCritical
'        Exit Sub
'    End If

' Exit the procedure if appointment has been added to Outlook.
If Me!chkAddedToOutlook.Value = True Then
    MsgBox "This appointment has already added to Microsoft Outlook.", vbCritical
    Exit Sub
End If

答案 1 :(得分:0)

使用表单模块中的代码时,如果正确,则使用原始语法;

If Me.chkAddedToOutlook = -1 Then

我更喜欢使用。因为它允许intellisense工作,并允许您引用您可以做的属性或方法!操作

答案 2 :(得分:0)

我知道这很旧,但我来到这里是因为我遇到了同样的错误。我将复选框标签命名为 ckDisableScroll 而不是实际控件。显然标签不能是真假。纠正错误后,一切都按预期进行。