469,140 Members | 1,158 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,140 developers. It's quick & easy.

Form/SubForm access problem

ego
Hi all ,

I had created the following Form/SubForm structure :

MainForm
SubForm A (SubForm of MainForm)
SubForm B (SubForm of SubForm A)
SubForm C (SubForm of SubForm B)
SubForm D (SubForm of SubForm C)

On each form I have a text box.
When The MainForm is open I had managed to access the text box on
SubForm A
With the following command:

Dim ctrlSubForm As Access.SubForm
Set ctrlSubForm = FrmSubSubjectASubForm
ctrlSubForm(SubSubjectA).Enabled = True
ctrlSubForm(SubSubjectA).SetFocus
B = ctrlSubForm(SubSubjectA).Text

But using the same method to access SubForm B,C, and D I got an error
message.

Please help me.
Thanks.

Nov 13 '05 #1
5 3385
> I had created the following Form/SubForm structure :

MainForm
SubForm A (SubForm of MainForm)
SubForm B (SubForm of SubForm A)
SubForm C (SubForm of SubForm B)
SubForm D (SubForm of SubForm C)

On each form I have a text box.
When The MainForm is open I had managed to access the text box on
SubForm A
With the following command:

Dim ctrlSubForm As Access.SubForm
Set ctrlSubForm = FrmSubSubjectASubForm
ctrlSubForm(SubSubjectA).Enabled = True
ctrlSubForm(SubSubjectA).SetFocus
B = ctrlSubForm(SubSubjectA).Text

But using the same method to access SubForm B,C, and D I got an error
message.


You can only nest so many subforms.
This shows the limit and syntax for referencing subforms:
Forms("frmMainForm")!frmSubFormA.Form!SubFormB.For m!txtBox

The only exception I've found is if you have a subdatasheet in SubFromB - it
displays okay, but I don't think you can reference it with code.
Nov 13 '05 #2
Ola E:

I know A97 was limited to subforms nested 3 deep at the max. I'm not
positive, but have not heard that this limitation has been altered in
any version since.

You can reference controls on an embedded subform or sub-subform much
more easily with dot referencing:

Me.mySfmA.Form.myControlName.Value

and

Me.mySfmA.Form.mySfmB.Form.myControlName.Value

where mySfmA is the name of the subform control on the main form and
mySfmB is the name of the subform control on the Form contained in the
mySfmA control. <= huh? even i'm confuzzed.

King Ron of Chi

Nov 13 '05 #3
ego
Thanks deko,
Have a nice day.

Nov 13 '05 #4
ego
Thanks King

Nov 13 '05 #5
ego
Hi again,

I tried to use both methods.
I got the following Error message on both cases:

" Object doesn't support this property or method (error 438) "

Ego

Nov 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by William Wisnieski | last post: by
11 posts views Thread by Jozef | last post: by
1 post views Thread by troy_lee | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.