>Hi all,
>
>What's the best way to setfocus to the control in a form (maybe with a pageframe to), that my COM object Bussiness Rules return's an error in it validate_data method, the return value from this method is the field name in 'lcerrofieldname'.
>
>Thank's in advance,
>
>João Batista
Two ideas came to mind:
1) If you always name your controls as txt+FieldName, you may try
if type('thisform.txt'+m.lcErrorFieldName)="O"
loObject = evaluate('thisform.txt'+m.lcErrorFieldName)
loObject.SetFocus()
endif
2) Otherwise you have to loop through form's controls until you find controlsource equals to the error field.
If it's not broken, fix it until it is.
My Blog