-
Oct 16th, 2014, 03:55 AM
#1
Thread Starter
Fanatic Member
Run Time Error 13 Type MisMatch
Hi
In the below code it is giving me the above error
Private Sub lvwitem_ItemClick(ByVal Item As MSComctlLib.ListItem)
Dim strItemKey As String
Dim strId As String
strItemKey = Item.Key
strId = Mid(strItemKey, 2)
If rstitem.RecordCount > 0 Then
rstitem.MoveFirst
End If
rstitem.Find ("icode = '" & Trim(strId) & "'")
If Not rstitem.EOF Then
Set ItmFound = lvwitem.FindItem(strId, 0, , 0)
End If
end sub
-
Oct 16th, 2014, 01:49 PM
#2
Re: Run Time Error 13 Type MisMatch
Which line?
What is ItmFound?
Are you using Option Explicit?
-
Oct 16th, 2014, 01:54 PM
#3
Re: Run Time Error 13 Type MisMatch
Also, it should be rstitem.findItem......if I recall correctly.
-
Oct 16th, 2014, 03:08 PM
#4
Re: Run Time Error 13 Type MisMatch
RSTItem is apparently a Recordset so Find would be correct.
OP needs to show which line the error occurs on and also needs to start using code tags when posting code
My guess is that the error is on this line
Set ItmFound = lvwitem.FindItem(strId, 0, , 0)
Note that ItmFound is not defined in the code shown so we have no idea if it is properly dimmed as a ListItem
-
Oct 16th, 2014, 03:12 PM
#5
Re: Run Time Error 13 Type MisMatch
I also have no idea what the purpose of that code is.
It is passed a listitem and then it searches the list for that list item and returns nothing?
If you already know the listitem, why search the listview for that listitem? Is it coming from a different listview?
-
Oct 16th, 2014, 03:28 PM
#6
Re: Run Time Error 13 Type MisMatch
Oh yeah.....I read it to fast....thought his rstitem was the LISTVIEW.....duh!
-
Oct 16th, 2014, 10:17 PM
#7
Addicted Member
Re: Run Time Error 13 Type MisMatch
Code:
Set ItmFound = lvwitem.FindItem(strId, 0, , 0)
I think your error lies in this part...
Check the DATA TYPE or how you DECLARED your ItmFound...
I think this is INTEGER, and your strid is passing a NULL STRING.
Which causes the MISMATCH.
Last edited by terry002; Oct 16th, 2014 at 10:23 PM.
If I had helped you...
Don't forget to mark your Inquiry as RESOLVED...
I will be glad if you can also give me some Reputation points in helping you (by Clicking Rate This Post)...
Happy VB Coding Everyone!
-
Oct 17th, 2014, 07:48 AM
#8
Re: Run Time Error 13 Type MisMatch
Tend to agree with terry002....what IS ItmFound declared as?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|