RunTime Error '13' Type Mismatch

Hey,

I have thsi code that I just cannot figure out. Anyone have any ideas why I'm getting a RunTime Error '13' Type Mismatch

Here is the VB code:

Dim CommunityMapTable() As Byte (Global Variable)

Private Sub LoadCommunityCombobox()
Dim I, J

CmbCommunityDescription.Clear
ReDim CommunityMapTable(CommunityLookupRec.CommunityCount)
J = 0
I = 0
While I < Val(CommunityLookupRec.CommunityCount)
If Trim(CommunityLookupRec.CommunityEntry(I).CommunityDesc) <> "" Then
CmbCommunityDescription.AddItem Trim(CommunityLookupRec.CommunityEntry(I).CommunityDesc)
CommunityMapTable(J) = CommunityLookupRec.CommunityEntry(I).Community
J = J + 1
End If
I = I + 1
Wend
CmbCommunityDescription.ListIndex = Val(CurrentUserCommunity) - 1
End Sub



Answer this question

RunTime Error '13' Type Mismatch

  • SOTY_Programmer

    I have had something similar when using comboboxes and List and ListIndexes.

    It is quite difficult to understand what your code is doing as (except that your are putting some data into the Combobox).

    You did not mention which line is creating the error but is it the one with the ListIndex

    Another suggestion would be to introduce more variables to hold some of the info that is looked up with the dot variables ie:

    dataToAdd=CommunityLookUpRec.CommunityEntry(i).Community.

    Then you can see exactly what is to be added

    Sorry if I have not helped at all, but I have had this problem in the past and it is to do with the ListIndex.

    ChasAA


  • Joel Triemstra

    Hey,

    Thanks for your quick reply. I don't think it has to do with the ListIndex line. It has more to do with Dim and ReDim of the array I am trying to populate.

    Dan


  • RunTime Error '13' Type Mismatch