So I have several main forms which contain the same subform. This one subform contains ~4 Controls / Labels that are only necessary for one of the main forms. I'd like to hide them in all instances except when the main form is named "x". I think hiding them is most efficient. Database needs to be done by Friday.
I've explored several variations of the below code with no effect what so ever. I've tried calling on the subform more specifically. (i.e. [Forms]![Main Form]![Subform]![Control Name].Visible = False)
Also, where is the best place to execute this code. Should it work in this general format or do I need to specifically "call" on the Sub? For example, OnOpen, etc. Please, forgive me! have been experimenting and teaching myself as I go, but it's crunch time now
Thank you!
Private Sub HideHeight()
On Error Resume Next
For Each frm In Forms
End Sub
I've explored several variations of the below code with no effect what so ever. I've tried calling on the subform more specifically. (i.e. [Forms]![Main Form]![Subform]![Control Name].Visible = False)
Also, where is the best place to execute this code. Should it work in this general format or do I need to specifically "call" on the Sub? For example, OnOpen, etc. Please, forgive me! have been experimenting and teaching myself as I go, but it's crunch time now

Private Sub HideHeight()
On Error Resume Next
For Each frm In Forms
If frm.Name <>"Baseline" Then
NextHeight.Visible = False
Height_Label.Visible = False
Label41.Visible = False
Weight.Visible = False
Weight_Label.Visible = False
Label42.Visible = False
Label39.Visible = False
BMI.Visible = False
ElseHeight_Label.Visible = False
Label41.Visible = False
Weight.Visible = False
Weight_Label.Visible = False
Label42.Visible = False
Label39.Visible = False
BMI.Visible = False
Height.Visible = True
Height_Label.Visible = True
Label41.Visible = True
Weight.Visible = True
Weight_Label.Visible = True
Label42.Visible = True
Label39.Visible = True
BMI.Visible = True
Height_Label.Visible = True
Label41.Visible = True
Weight.Visible = True
Weight_Label.Visible = True
Label42.Visible = True
Label39.Visible = True
BMI.Visible = True
End Sub
Last edited: