Deepest Level Form Addressing

omontesg

Registered User.
Local time
Today, 13:59
Joined
Feb 8, 2008
Messages
10
Hi everyone,

Does anybody knows how to address a Fifth level Form? Up to the fourth level, for me worked the following statement:

Forms!frmClass!frmGroup!frmAccount!frmSubAccount!frmAuxiliar.Form.Name

...But if a I insert a new form and want to address that one deeper level Form; ACCESS says "It can not find the Field frmClass" (observe this is the first Form name)

(N.B as far as I know ACCESS can support 7 levels deep Forms structure. Is that true??)

Any help would be apprecciated.
Thanks in advance.
O. Montes
 
Yes, 7 levels. The easiest way is this:
Code:
Forms("Form1").Controls("Subform1").Form.Controls("Subform2").Form.Controls("Subform3").Controls("Subform4").Controls("Subform5").Form.YourControlNameHere

This is the easiest way because it repeats so easily. Just remember you want to refer in the Controls("Subform") part to the subform CONTROL name which houses the subform on the main form and not the subform name itself unless it is the same exact name.
 
That which is being addressed is very dependant on where it is being addressed from.

Is this being addressed from the top Form or is it being addressed from a standard module?
 
Thanks Bob, thanks ChrisO for your prompt anwers.

Both ways (Bob's and mine) worked OK. my problem was a name in a form. (that's the bad thing of Cut+Paste).

I am addressing the forms from the top one. Any way, ChrisO, I am interested in knowing the difference between the two ways You mention.

Thanks boys.

O. Montes
 
What Bob has supplied is okay for your purposes.

My point is that when asking how to address something people should supply both where they are and where they want to go.

They may be at the top level, as in this case, so Forms("TopFormName")…is okay.
They may be in a query so Forms!TopFormName…might be needed.
They may be in a standard module and get passed Me so referring to the passed argument is generally all that is needed.
They may be in a standard module and get passed a form control so FormControl.Parent is all that is needed.

It seems obvious but if someone asks 'How do I get to Honolulu?' the answer depends on where you are starting from, Fort Shafter or New York.

So, how you get somewhere also depends on where you are starting from.

Often that information is not supplied.
 
Yes, You are right. Thanks for your time and explanation.

O.Montes
 

Users who are viewing this thread

Back
Top Bottom