Marten Onnink
Marten Onnink

Reputation: 131

438 runtime error when using the checkbox function in Access VBA

I get a 438 runtime error when using a checkbox on an Access 2007 form: 'Object doesn't support this property or method'. What is going wrong and how I can fix this?

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

Upvotes: 0

Views: 512

Answers (3)

Jeff
Jeff

Reputation: 1

I know this is old but I got here because I had the same error. I had named the checkbox label ckDisableScroll instead of the actual control. Obviously labels can't be true of false. Once the error was corrected, everything worked as expected.

Upvotes: 0

Minty
Minty

Reputation: 1626

Your Original syntax if correct when you are using the code in a module on the form;

If Me.chkAddedToOutlook = -1 Then

I prefer to use the . as it allows the intellisense to work, and allows you to reference a property or a method which you can't do with the ! operator.

Upvotes: 0

Gustav
Gustav

Reputation: 55831

You may have to be more specific:

If Me!chkAddedToOutlook.Value = True Then

Edit:

'    ' 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

Upvotes: 0

Related Questions