Invalid procedure call or argument error

Anonymous
2024-05-22T18:05:37+00:00

When pressing a command button the code below is executed, and it results in an error as seen in the picture

Cmd button Code:
Private Sub cmdCheck_Click()

On Error GoTo Err_Close_Jobs

Dim i As Integer 

' check in our list 

If MySel(Me!Cat) Then 

   ' already in list - remove 

   CheckItems.Remove CStr(Me!Cat) 

Else 

   ' not in the list - add it 

   CheckItems.Add Me!Cat.Value, CStr(Me!Cat) 

' Debug.Print CheckItems

End If 

Me.ckSel.Requery 

Exit_Close_Jobs:

Exit Sub 

Err_Close_Jobs:

MsgBox Err.Number & "/" & Err.Description 

Resume Exit\_Close\_Jobs 

End Sub

Code:

Public CheckItems As New Collection

Private Sub cmdCheck_Click()

On Error GoTo Err_Close_Jobs

Dim i As Integer 

' check in our list 

If MySel(Me!Cat) Then 

   ' already in list - remove 

   CheckItems.Remove CStr(Me!Cat) 

Else 

   ' not in the list - add it 

   CheckItems.Add Me!Cat.Value, CStr(Me!Cat) 

' Debug.Print CheckItems

End If 

Me.ckSel.Requery 

Exit_Close_Jobs:

Exit Sub 

Err_Close_Jobs:

MsgBox Err.Number & "/" & Err.Description 

Resume Exit\_Close\_Jobs 

End Sub

Microsoft 365 and Office | Access | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

11 answers

Sort by: Most helpful
  1. Anonymous
    2024-05-24T05:14:33+00:00

    Hi Ahiezer,

    Backup your Access file and do the following steps:

    • Uncheck 'Microsoft Outlook 16.0 Object Library' if you do not use it.
    • Compact and Repair Database from Database Tools tab.

    This error can also occur if an attempt is made to call a procedure that isn't valid on the current platform, see below for more details:

    https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/invalid-procedure-call-or-argument-error-5

    Finally, try to open your Access file on another computer to see if it resolves the issue.

    Best Regards,

    Sophia

    0 comments No comments
  2. Anonymous
    2024-05-28T17:33:05+00:00

    I can't seem to uncheck 'Microsoft Outlook 16.0 Object Library', it displays a warning message.

    0 comments No comments
  3. Anonymous
    2024-05-23T13:04:33+00:00

    Hi Ahiezer,

    I've tried your code and it worked for me:

    This might be something related to Reference Issues:

    In rare cases, reference issues with external libraries can cause this error.

    Try checking the references (Tools -> References).

    Best Regards,

    Sophia

    0 comments No comments
  4. Anonymous
    2024-05-23T18:41:27+00:00

    What should be checked in the references?

    Also, this was working just fine before. I don't know why it started showing this issue and I'm the only user with this issue.

    0 comments No comments
  5. Anonymous
    2024-05-28T21:43:27+00:00

    Ok I unchecked 'Microsoft Outlook 16.0 Object Library' and hit compact and repair but i still get the error.

    I dont get any issues opening it on another computer. Other users dont report having this issue.

    0 comments No comments