Form-property of sub-subform

B

Bert

Hi,

I've got this situation:
* frmOne, the masterform
* frmTwo, a subform of frmOne. The subformobject is 'subTwo'
* frmThree, a subform of frmTwo The subformobject (in frmTwo) is 'subThree'

All three forms are in single-view

Now from frmOne I can get a variable with the form-object of frmTwo. In
frmOne I use (i.e.) the code:
*****
Private Sub Form_Load()
Dim frm2 As Form
Set frm2 = Me!subTwo.Form
End Sub
*****

Now I need a reference to the Form-property of frmThree, as a sub-subform in
frmOne, such like:
*****
Private Sub Form_Load()
Dim frm2 As Form
Dim frm3 As Form

Set frm2 = Me!subTwo.Form
Set frm3 = frm2!subThree.Form
End Sub
*****

But the only thing I get is error 2455: invalid reference to form/report
property

I can access 'subThree', because 'frm2!subThree.SourceObject' returns the
name of the form that is in subThree. But I don't need the name, but the
Form-object.

Any idea?

Thank you,
Bert
 
R

rkc

Bert said:
Hi,

I've got this situation:
* frmOne, the masterform
* frmTwo, a subform of frmOne. The subformobject is 'subTwo'
* frmThree, a subform of frmTwo The subformobject (in frmTwo) is 'subThree'

All three forms are in single-view

Now from frmOne I can get a variable with the form-object of frmTwo. In
frmOne I use (i.e.) the code:
*****
Private Sub Form_Load()
Dim frm2 As Form
Set frm2 = Me!subTwo.Form
End Sub
*****

Now I need a reference to the Form-property of frmThree, as a sub-subform in
frmOne, such like:
*****
Private Sub Form_Load()
Dim frm2 As Form
Dim frm3 As Form

Set frm2 = Me!subTwo.Form
Set frm3 = frm2!subThree.Form
End Sub
*****

But the only thing I get is error 2455: invalid reference to form/report
property

I can access 'subThree', because 'frm2!subThree.SourceObject' returns the
name of the form that is in subThree. But I don't need the name, but the
Form-object.

Any idea?

Post the actual. I see nothing wrong except that in your example
everything goes out of scope after the form loads.
 
B

Bert

Hi,

Problem seems to be solved. I couldn't access the properties of the nested
subform because it was unvisible and width/height both were 0. Now after
'initializing' the dynamic layout of frmTwo (which contains the positioning
of subThree) I can access the properties very well.

Bert
 

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