I'm not sure about when the End If got seperated, but it is fixed now. So here is what I have:
Dim tempAge, iNumRec, Median, intMedian, iCounter
Set objRS = Server.CreateObject ("ADODB.Recordset")
sql="SELECT PTAGE FROM Median"
objRS.Open sql, objConn, 3...