It might be better to explain your project more, and we might suggest an alternate method to achieve your goal.

The fnLDAPQuery() UDF is great at gathering data from AD. I've used this to gather and manipulate data for large (40,000+ user object) AD migrations. In some cases, it was faster/easier to collect the data with Kix and save it as .CSV, then use Excel to filter the data into a format that Kix could then use for the actual manipulation. Yes - it could have been done all with Kix, but the user data was inconsistently formatted and it was faster to do a visual check than write code for all the possible exceptions.

As for your script, don't use "yes/no" for flags - use 0 or 1, then you can simplify the tests:
 Code:
$Change = 0
If A <> B
  $Change = 1
EndIf
; more stuff...
If $Change
  ; do other stuff for changes..
EndIf
Look at my Bool() UDF, which converts values like "True/False", "Yes/No", and "On/Off" to Boolean values if you need to translate human-readable values into simpler versions for fast comparisons.

Be sure you init your counter to 0 where needed, or it will only work for the first iteration.

Consider a Select/Case/EndSelect for individual comparisons, since only one match is possible, it's easier than multiple IFs and less confusing than many AND/OR comparisons.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D