DMax(Len(rs.Fields(i).Name),strobjectname) will be firstly calculated to DMax(Numberic Value,strobjectname) , so DMax will not return the right thing you are looking for. You'd better to use select ... max(len(fieldname)) from....., will give you the max len and the field value.
By the way...