Re: When a search fails how to handle.

2014-02-15 Thread LB
Hi Jonathan, This is what Chip means: Function ReturnControl( Obj, MySearchItem) 'Return A Control. Set ReturnControl = Nothing FOR EACH oChild IN Obj.Children IF oChild.Name = MySearchItem THEN Set ReturnControl = oChild EXIT Function End If END FOR End Function Bruce

RE: When a search fails how to handle.

2014-02-15 Thread Chip Orange
Hi Jonathin, First, you should not use the variable you are using to loop through your collection, outside of the "for each" loop. It's not defined to have any value. This is why you are sometimes getting an error in the line which tries to use oChild. I'd suggest before the "for each" loop, t

When a search fails how to handle.

2014-02-15 Thread Jonathan C. Cohn
Good day, I have made progress in creating a script that searches for a given control. FOR EACH oChild IN Obj.Children IF oChild.Name = MySearchItem THEN EXIT FOR END FOR ' Nex line errors when search failed. IF oChild IS NOTHING THEN ReturnValue = N