This code sorta works. When you look at the contents of the array the records are sperated by many blank spaces. My goal is that if the agency id in the sql record set is not in the arrayagencies I want to add it. Any ides? The sql recordset has valid data without any blank rows. DIM arrayagencies(),oldsize,varcount,iCTR,isequal varcount = rsCount(0) ' this is a count of the records in the rsReportData() recordset - retrieved earlier on page oldsize = 0 j = 0 Do While Not rsReportData.EOF reDim preserve arrayagencies(varcount + oldsize) j = 0 Dim newubound newUbound = Ubound(arrayagencies) For j = 0 to UBOUND(arrayagencies) If arrayagencies(j) = mid(trim(rsReportData("AgencyID")),1,36) Then isequal = "true" End IF Next If isequal <> "true" then arrayagencies(newubound) = mid(trim(rsReportData("AgencyId")),1,36) End IF true = "" isequal = "" oldsize = newubound rsReportData.movenext iCtr = iCtr + 1 Loop * * * This message, including any attachments, is intended solely for the use of the named recipient(s) and may contain confidential and/or priveleged information. Any unauthorized review, use, disclosure or distribution of this communication(s) is expressly prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy any and all copies of the original message.