Referencing a subforms controls

crook_n_flail

Registered User.
Local time
Today, 03:48
Joined
Aug 18, 2001
Messages
11
I have a form with a subform but the subform's Source Object property can be one of several forms based on a combo box selection the user makes on the main form. How can I reference different controls on these possible subforms? Any information is greatly appreciated and if I need to be more specific just let me know.

Regards,
Crook_n_Flail
 
As long as the control name is present on the subform that is the current Source Object of the sub form, the following syntax should work:

ParentFormName.subFormControlName.Form.ControlName

Or, if you want to assign the name of the control on the sub form dynamically to a string variable:

Dim strControlName AS String

strControlName = "txtControlInQuestion"

ParentFormName.subFormControlName.Form.Controls(strControlName)
 

Users who are viewing this thread

Back
Top Bottom