>Hi Tamar,
>
>
>>Why not? It's just a variable, either local (if defined) or private. I use constructions like this a lot to find things in collections.
>
>Now I'm more confused. You say you use it a lot - Mark says it doesn't work. I've never expected it behave that way.
>
>I've always worked on the assumption that the reference scope is local to the FOR EACH..ENDFOR block. Can you give me an example where this isn't the case ?
>
This code works:
lFound = .F.
FOR EACH oProp IN oDocument.CustomDocumentProperties
IF oProp.Name == "iDocumentID"
lFound = .T.
EXIT
ENDIF
ENDFOR
IF lFound
iDocID = oProp.Value
ENDIF
Tamar