Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get properties of subForm

Status
Not open for further replies.

ImpMan

Technical User
Jan 25, 2001
42
0
0
GB
I have placed a subform on a main form.

The name of the subform on the mainform is subform1.
The source object object for subform is subFormDetails

Within subformDetails I have some code running.

How do I retrieve what the subform is called on the mainform using code. The return value I want is 'subform1'.

I seem to be able to return properties about objects within the subform, but what I want are properties about the instance of the subform within the main form. This is because I want to have a couple of the same subforms on the main form but with slightly different behaviour which is controlled via code.

Any ideas.

Thanks in advance
 
Hi

Are you aware of the Parent. property as a way of refering to the mainform?

Where is the code going to be - in the main form or in the subform?

You can refer to the sub form via the form property of teh subform control, so in the mainform:

Me.SubFormControlName.FORM.txtFieldName



Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
I don't want to retrieve properties of the controls on the subform. I want to return the 'name' propery of the instance of the subform that is used on the mainform.

The code is in the subform. This is what makes it tricky I think.


Hope this helps.

 
Hi

The name of the subform within the subform control is the .sourceobject of the subform control,

you should be able to retrieve that in code from within the subform so

Parent.SubFormControlname.sourceobject

by I think you would get the same effect with a simple me.name (have not tried it however)

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
The name of the subform within the main form is whatever you want it to be. This is what I want to try and get.

The original post explains this.

I am trying to get to the name of the subform not the source object.

Thanks


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top