0
votes

I have a form called Workbench. Within that form is tab control with a sub form called "sup_contacts_info" with a control called cmb_contacts. Now I know that tabs are ignored when retrieving values from a control within a form embedded within. That said, I know that this parameter works for my pulldown control.

[Forms]![Workbench]![sup_contacts_info].[Form]![cmb_contacts]

Now within the sup_contacts_info sub-form is yet another sub-form called sup_subform_contact_cards and a control called txt_sc_owner_id. I want the default value of this control to equal that of [Forms]![Workbench]![sup_contacts_info].[Form]![cmb_contacts]

I tried

[Forms]![Workbench]![sup_subform_contacts_cards].[Form]!txt_sc_owner_id.DefaultValue = [Forms]![Workbench]![sup_contacts_info].[Form]![cmb_contacts]

Access complains that it cannot find the control. I've tried:

[Forms]![Workbench]![sup_contacts_info].[Form]![sup_subform_contacts_cards].[Form]!txt_sc_owner_id.DefaultValue 

..to go from the sub-form to the sub-sub form but had no luck (perhaps I'm missing something)

I think it may be the way I am trying to a sub-form control, to what I think is a sub-sub control. What is cleaner (or shorter) way to make this call.

enter image description here

Where #1 is the parent form (workbench), #2 is the sub-form (sup_contacts_info) with the combo-box pulldown, and #3 is the sub-sub-form (sup_subform_contact_cards) with the text box (txt_sc_owner_id) whose default parameter I want to equal that of the combo-box pulldown.

Thanks

1
If you want textbox DefaultValue property to reference combobox, try: Parent.cmb_contacts. If you want VBA referencing both controls, which form event is code in? Be aware, subforms load before parent forms. - June7
I tested VBA using: Me.Parent.cmb_contacts in subsubform Load event and it works. - June7

1 Answers

0
votes

Mapping to Me.Parent.cmb_contacts was a huge help!