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

Hiding control in subform

Status
Not open for further replies.

Maldini

Technical User
Nov 10, 2002
55
0
0
GB
Just made a form containing two subforms, each subform linked via a common field with the main form....
problem is, I don't want the repeated field to be shown in the two subforms, rather, I want it hidden with only the one on the main form shown...

Tried changing the properties of the controls in design view, in the first tab (access xp), 3rd option down, which should be the one for visibility (sorry, not english version I'm using) but to no effect.... they continue showing up...

Anyone kind enough to teach me how to hide these controls in the subform?

Thx.
Maldini
 
You can try doing it in code.

Add this to the OnOpen event of your main form:

forms!mainformname!subformname!subformfieldname.visible = False

NB: The subformname is the name of the subform control on the main form, which may be different from the actual name of the subform (if that makes sense). eg. The name shown under Other:Name on the main form in properties.

For instance you might create a subform called SubMyForm, but when you add it to your main form you might call it RecordList. You would reference the form as RecordList and not SubMyForm.

Took me ages to figure that out!!!
 
Thx for the reply.

One thing is definitely puzzling me now, I tried the above with those two fields in the subforms, yet they still show up on the screen.
I use the same code for a field on the main form just to test I've gotten it right, and that textbox on the main form disappears with its label.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top