Reputation: 109
I have a form "frm_Results" with subform "subfrm_shv_Results" and three textboxes ("txt_Number", "txt_Name", 'txt_Surname").
I can show values of selected record in Debug.Print
or MsgBox
:
Debug.Print Form_frm_Results.subfrm_shv_Results.Form!Number.Value
Debug.Print Form_frm_Results.subfrm_shv_Results.Form!Name.Value
Debug.Print Form_frm_Results.subfrm_shv_Results.Form!Surname.Value
But it is possible to show values of "Number", "Name" and "Surname" in textboxes after click on record in subform "subfrm_shv_Results"?
Upvotes: 1
Views: 2164
Reputation: 91356
Yes, you can do this, with a query as the contained object, you need to refer to the controls property, for example, you can set the control source of a textbox to :
= [Forms]![frm_Results]![subfrm_shv_Results].form.controls(0)
Similarly, with a continuous form or such like :
= [Forms]![frm_Results]![subfrm_shv_Results].Form!Surname
The result is not editable, but you can get around this by setting the value in VBA.
Make sure you use the name of the subform control, not the the name of the form contained.
Upvotes: 1