I think a cleaner (and more dependable) way to handle this would be to get an object reference using EVAL, and then call setfocus with that reference:
IF this.name = thisform.lastcontrol
oControl = EVAL(thisform.FirstControl)
oControl.setfocus()
ENDIF
this will get around the quirkiness of macro expansion and 'THISFORM'.
>Vicki, if you do it with the first/last form properties, then you don't need to work with the CONTROLS object. All you need in the textbox class is a call in the lostfocus to check the property:
>IF this.name = thisform.lastcontrol
> this.parent.&thisform.firstcontrol..setfocus()
>ENDIF
>
>This is NOT tested code - I've found macros don't usually work with a 'thisform' in them, so you'll have to adjust for that.... But I hope it gets you started.
>
>Barbara
>
>
>
>>Are my textboxes subclassed - you bet. But not all my fields are text boxes tho all are subclassed. My concern was having to put code in every field but I didn't think about setting a "first" and "last" as form properties and noting it that way. It allows me to set it once and change it (if needed) without dealing with each field. Great! Now, if I can figure out how to work with the Controls code, I'll be on my way<g>. Thanks.
Erik Moore
Clientelligence