Run-time error 6013 VBA - Access - List box

Hi experts
Getting an error "Run-time error 6013" Unable to remove item - When I am clicking on a wrong button in my form to move items in between two list boxes.
I am using the method as in Its working fine but not able to handle the error messages. Some times blank items coming in - when clicking on wrong button - getting error messages - etc. Please kindly help.
Who is Participating?
GrahamMandenoConnect With a Mentor Commented:
It seems that you just need some error handling.  In each of the MoveXXXXItems procedures, add the following code:

At the beginning:
   On Error GoTo ProcErr

At the end, just before End Sub:
    Exit Sub
    Select Case Err.Number
        Case 6013
            MsgBox "Nothing to move"
        Case Else
            MsgBox "Error #" & Err.Number & vbCrLf & Err.Description
    End Select
    Resume ProcExit

Open in new window

Then error 6013 will give a meaningful error, and any other error will give a message but continue without stopping the code.

Best wishes,
Graham Mandeno [Access MVP 1996-2014]
gtmathewDallasAuthor Commented:
Thank you so much GrahamMandeno, It is good one..Thanks again..
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.