By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,606 Members | 3,832 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,606 IT Pros & Developers. It's quick & easy.

Form/SubForm access problem

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
> 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

P: n/a
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

P: n/a
ego
Thanks deko,
Have a nice day.

Nov 13 '05 #4

P: n/a
ego
Thanks King

Nov 13 '05 #5

P: n/a
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.