Click here to Skip to main content
15,669,039 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a sport form called Frm_Sprt_Acnt
it could be called from many subforms
when call it I store the caller subform and its parent and control
how I could return focus to caller control dynamically
I can't get the equivalent of Forms![Frm_TR_Itms_Main]![Frm_TR_Itms_Dtls].Form![TfTrItmDtls_Itm] but dynamically codded

What I have tried:

Public Sub CtrlButClose_Click()
On Error GoTo CtrlButClose_Click_Error

If Nz(Me.Ctr_CallerFormMain, "") <> "" Then
    ''OK 'Forms!Frm_TR_Itms_Main!Frm_TR_Itms_Dtls.Form!TfTrItmDtls_Itm.SetFocus''OK
End If

DoCmd.Close acForm, Me.Form.Name

On Error GoTo 0
Exit Sub
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure CtrlButClose_Click, line " & Erl & "."

End Sub
Maciej Los 15-Feb-22 14:14pm    
What you mean: "dynamically codded"?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900