Hi Everyone, I am trying to sort a multi dimensional array but am getting an error. Can someone please help me out. Here is a sample of the array (it is created dynamically from the db): myArray(0,1) = Denom myArray(1,1) = JCCA myArray(2,1) = Camp One myArray(3,1) = 1188 myArray(4,1) = 1188 myArray(0,2) = None myArray(1,2) = JCCA myArray(2,2) = Camp Two myArray(3,2) = 0 myArray(4,2) = 0 myArray(0,3) = Denom 2 myArray(1,3) = Independent myArray(2,3) = Three Camp myArray(3,3) = 595 myArray(4,3) = 595 myArray(0,4) = Non-denominational myArray(1,4) = JCCA myArray(2,4) = Camp Four myArray(3,4) = 563 myArray(4,4) = 563 myArray(0,5) = None myArray(1,5) = JCCA myArray(2,5) = Camp Mountain myArray(3,5) = 0 myArray(4,5) = 0 Code (markup): I want it to sort by the third item inthe array so it should look like this: Non-denominational,JCCA,Camp Four,563,563 None,JCCA,Camp Mountain,0,0 Denom,JCCA,Camp One,1188,1188 None,JCCA,Camp Two,0,0 Denom 2,Independent,Three Camp,595,595 Code (markup): The function I am using is: <% '============================================== function arraySort( arToSort, sortBy, compareDates ) '============================================== Dim c, d, e, smallestValue, smallestIndex, tempValue For c = 0 To uBound( arToSort, 2 ) - 1 smallestValue = arToSort( sortBy, c ) smallestIndex = c For d = c + 1 To uBound( arToSort, 2 ) if not compareDates then if strComp( arToSort( sortBy, d ), smallestValue ) < 0 Then smallestValue = arToSort( sortBy, d ) smallestIndex = d End if else if not isDate( smallestValue ) then arraySort = arraySort( arToSort, sortBy, false) exit function else if dateDiff( "d", arToSort( sortBy, d ), smallestValue ) > 0 Then smallestValue = arToSort( sortBy, d ) smallestIndex = d End if end if end if Next if smallestIndex <> c Then 'swap For e = 0 To uBound( arToSort, 1 ) tempValue = arToSort( e, smallestIndex ) arToSort( e, smallestIndex ) = arToSort( e, c ) arToSort( e, c ) = tempValue Next End if Next End Function%> Code (markup): And I call the function like this: myArray=arraySort(myArray,2,false) Code (markup): But I get the following error on the previous line of code: Microsoft VBScript runtime error '800a000d' Type mismatch I know that the array is created properly because I am able to manipulate it elsewhere. So what am I do wrong? Thanks!