I have sub that loops the columns in a mshflexgrid and loads unique items
into 7 comboboxes. I need to clear the array between calls as the array seems to be holding values between calls. How can i do this ?
Code:
Private Type Report
 RefName As String * 25 
 RefCnt As Long 'the count for each entry
End Type


   'fill the combos with unique values
    CountUniqueValues Region, cboRegion, "< All Regions >"
    CountUniqueValues Referrer, cboReferer, "< All Referrers >"
    CountUniqueValues Material_Style, cboMaterialStyle, "< All Material Styles >"
    CountUniqueValues Material_Type, cboMaterialType, "< All Material Types >"
    CountUniqueValues Material_Color, cboMaterialColor, "< All Material Colors >"
    CountUniqueValues Job_Type, cboJobType, "< All Job Types >"
    CountUniqueValues Entered_By, cboEnteredBy, "< All Entered By >"
    CountUniqueValues Estimator, CboEstimater, "< All Estimators/Salesman >"


Sub CountUniqueValues(c As Integer, cbo As ComboBox, cboText As String)
  Dim r As Long
  Dim CurRef, LastRef As String
  ReDim Refs(0) As Report
  Dim i As Long
  Dim RName As String
  Dim RCount As Long



    GridMisc.Col = c
    GridMisc.Sort = 5 'text ascending sort

  For r = 1 To GridMisc.Rows - 1
    If GridMisc.TextMatrix(r, c) <> "" Then
      CurRef = GridMisc.TextMatrix(r, c)
    End If
     
    If LastRef = CurRef Then
      Refs(UBound(Refs)).RefCnt = Refs(UBound(Refs)).RefCnt + 1
    Else

         ReDim Preserve Refs(UBound(Refs) + 1)
         Refs(UBound(Refs)).RefName = CurRef
         Refs(UBound(Refs)).RefCnt = 1
         LastRef = CurRef
    End If
Next r


For i = 1 To UBound(Refs)
    RName = Trim(Refs(i).RefName)
    RCount = Refs(i).RefCnt
    GridRecap.AddItem vbTab & RName & vbTab & CStr(RCount)    
   'Debug.Print RName & vbTab & CStr(RCount)
Next i
  
 
End Sub