Is a subform Control not a subform control if... (1 Viewer)

MackMan

Registered User.
Local time
Today, 07:24
Joined
Nov 25, 2014
Messages
174
Morning all. I have a Main form "frmREPORTS" and within it contains a sub form control "SFControl". I'm using a subform control so I can call its recordsource through VBA to view various continuous forms from within the same space, depending on what form the user selects.

Here's the question...but forgive me while I try to describe it....
lets say I have frmPayeesSub as one of the forms I want to view from within the subform control... ( I can get it to show no problems but I'm having a lot of difficulty referring to a control within the subform that sits in the subform control on the main form)

Would the reference to the sub form be Forms!frmREPORTS!frmPayeesSub.form!Control

Or would it be something like forms!frmREPORTS!SFControl.form!frmPayeesSub.form!control


If I embed frmpayeessub within the main form frmReports, I have no issues...

is this even possible?

As always, appreciate your patience as this is probably a dumb question.. I guess.. is the subform control a control within itself? I can't find anything online.
 

KenHigg

Registered User
Local time
Today, 02:24
Joined
Jun 9, 2004
Messages
13,327
You may have to test to determine which subform is active before you refer to controls on it.
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 16:24
Joined
Jan 20, 2009
Messages
12,852
The subformcontrol has a SourceObject property that defines the object it will display. This object becomes the Form property of the subformcontrol in that context.

Referring to the controls on the subform's SourceObject does not involve the form object being explicitly named in the reference.

Code:
Forms!mainformname.subformcontrolname[B][B].Form[/B][/B].controlname

However they can aslo be referred to without the Form property as:

Code:
Forms!mainformname.subformcontrolname[B]![/B]controlname

Note the bang operator is essential. It stands for the default collection of the subformcontrol, the Controls Collection of its SourceObject.
 

MackMan

Registered User.
Local time
Today, 07:24
Joined
Nov 25, 2014
Messages
174
Glaxiom. Thank you. I've been trying all sorts, and the solution was much more simple. That makes much more sense. Once again, thank you!"!
 

Users who are viewing this thread

Top Bottom