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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to refer to a subform that is on a subform that in turn is on a ta

Status
Not open for further replies.

TraceyBennet

Technical User
Sep 19, 2001
8
GB
Hi

I need to refer to the visible property of a subform that is on a subform that in turn is on a tab form on my main form within an event procedure - confused, so am I.

What i want to do is something like this:

(Main Form) (Tab form) (1st Sub frm) (2nd Sub frm)
frmMainDataEnty -> tabOne -> frmSubItemInfo -> frmSubItemInfo2.Visible = True

I have tried as many ways as I can find in access help to do this but access 2k keeps saying it cant find specific fields or forms depending on the manner which I refer to it.

I have trued things like:
Forms![frmMainDataEntry]![TabCtl34]![frmTrackInfoMain]![frmTrackInfoMainSub2].Visible = True
[Forms]![frmMainDataEntry]![frmTrackInfoMain].form![frmTrackInfoMainSub2].Form.Visible = True

Can some one put me on the right track as I am at a loss as to what to do next.

Thank you in advance,

Kenny
 
Yes, but ignore the tab control. The tab control does not serve as an object model container for the subform. To do what you are requesting, try something like this...

Forms("frmMainDataEnty").frmSubItemInfo.Form. frmSubItemInfo2.Visible = True

OR

Me.frmSubItemInfo.Form.frmSubItemInfo2.Visible = True

The subform is a member of the controls collection on the main form. Being that the subform control only displays the form underneath, we need to access the "Form" property of that control to reference the subform's "frmSubItemInfo2" control and set it to true.

I hope that clears things up for you.

Gary
gwinn7
 
Try:

Forms!MainForm!Subform1!Subform2.Form!Text0.Visible = False

Uncle Jack
 
Hey guys, thanks for the suggestions but it still dont work,

I just get a "runtime error" 2465 ??

Tracy
 
Try setting the focus explicitly to the first subform

Me!frmSubItemInfo.SetFocus
Me!frmSubItemInfo![Form]!frmSubItemInfo.Visible = True

HTH
Lightning
 
I don't understand why it doesn't work. I set this up on my machine and it works fine. Perhaps you have a syntax error.

Forms!MainForm!Subform1!Subform2.Form!Text0.Visible = False

The control is on subform2. Subform2 is embedded in Subform1. Subform1 is on the MainForm.

Uncle Jack
 
Uncle Jack,

Hi again,

I wonder is the problem might be that Access2k is looking for a field and not a FORM. Its the visible property of the whole form called subform2 that i need to hide by setting its visible property to false ??

What do you think ?

Tracey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top