You could accomplish this same thing without modifying the DO FORM calls by using the _Screen.ActiveForm property. The ActiveForm property doesn't change its value to the new form, until the Activate event of the new form so it holds an object reference to the form that made the call.
The only caveat that needs to be added is that forms with some ActiveX controls could present a problem. The ActiveX control sometimes presents itself as the ActiveForm. A simple check of the BaseClass property to determine if _Screen.ActiveForm is a "Form" could be used before assigning the variable.
>In order to not go back to the command window, and assuming that forma calls formb, you could add a property to your forms called "oCallingForm".
>
>In the form's init put:
>
>
lparameters lCallingForm
>
>if pcount() > 0
> ThisForm.oCallingForm = lCallingForm
>
>endif
>
>In the event that releases the current form, then put:
>
>if vartype( Thisform.oCallingForm) = "O"
> ThisForm.oCallingForm.setfocus()
>endif
>
>ThisForm.release()
>
>Now, when calling this form from another one, let's say, through a button click, instead of simply do form..., do:
>
>do form xyz with ThisForm
>
>
>
>
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao