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

Making subforms visible / invisible via a combo box

Status
Not open for further replies.

DropsIT

MIS
Jun 12, 2003
37
GB
I have combo box set up based upon a table (Maintenance)containing the subform name and various y/n fields. (one of which is to make the form visible / invisible - column 3 in the table). Each subform is merely a view of a listing table that users can update, amend or delete records.

The idea is that the user selects the form from the combo box (MaintCmb)and the current subform disppears and the subform related to the combo box selection then appears on the after update event.I wanted to do it this way so that I can easily add more subforms to the table without having to hardcode them in the VB.

However I am having trouble getting this to work as I get an error saying that it cannot find the correct subform. Can someone please let me know what the VB is just confirm that I am using the correct code. Do I have to link the main form to the subform in both the form name in the table for the combo box or can I just use the subform name with the visible control ??

Thanks

 
I am not quite sure I understand what you are saying. To make a subform visible or to hide it, just use the name of the subform control:
Me.[SubformControlName].Visible = False 'True

You cannot add a subform control except in design view, I think, but you can change the form the control contains and set the link fields.
 
Even when using the basic 'Forms!M_REV.Visible' = True I am getting an error that the form M_REV cannot be found.

I have also used 'Forms!M_REV.Controls.Vsible = True' I get the same result.


Does it make any difference if the subform is part of a TabControl ?
 
The subform is contained in a subform control on the main form. Is M_Rev the name of the subform control (not the subform contained) on the main form? It is often handy to type a dot (.) as this activated the intellisense for the form:
Me. <-should give a list of controls, with other stuff.

The tab control should not make any difference.
 
Try:
Forms!Trans_Sel!M_Rev.Visible=False
Or
Me.M_Rev.Visible=False
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top