Use Me to refer to a separate subform?

P

Peter Stone

Good Evening

I am on a subform of my main form and want to refer to a separate subform of
the main form. Can I use Me:

Me!sfrmHeader.sfrmHeader!cboDestination

or do I have to refer to the main form:

Forms!frmText!sfrmHeader.sfrmHeader!cboDestination

(the subform control has the same name as the subform).

I know I could try it, but I have to change a large number of references and
I want to do it all at once.

Thank you

Peter
 
J

Jeff Boyce

Peter

"Me" refers to the object in which the code is running, if I recall
correctly. Have you looked at using "Parent"? This might give you a way to
refer back "up" from within a subform, then "back down" into another
subform.

Or you might be able to set variables equal to the various forms/subforms
you'll want to use, and refer to those variables instead...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
M

Marshall Barton

Peter said:
I am on a subform of my main form and want to refer to a separate subform of
the main form. Can I use Me:

Me!sfrmHeader.sfrmHeader!cboDestination

or do I have to refer to the main form:

Forms!frmText!sfrmHeader.sfrmHeader!cboDestination

(the subform control has the same name as the subform).


Sort of.

Me.Parent.sfrmHeader.Form.cboDestination
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top