for each loUser in loUsers ? loUser.DS_CN, loUser.DS_SAMAccountName endforIt works fine for me either way (But, for some unknown to me reason, we do not have the ds_department, at least we do not have it populated). Usually the ExecQuery does not give an error even when there is a syntax error in the WQL statement (not that I see one in yours), but the error comes when you try to use the result set. What does loUsers.Count return?
loUsers = loLDAP.ExecQuery( [Select * from ds_user where ds_SAMAccountName = 'RAN02' ]) * AND loUsers = loLDAP.ExecQuery( [Select DS_CN, DS_SAMAccountName, ds_department from ds_user where ds_SAMAccountName = 'RAN02' ]) for each loUser in loUsers ? loUser.DS_CN, loUser.DS_SAMAccountName, loUser.ds_department endfor[/update]