Show submenu in form IF condition met

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

Hi there

How do I get to hide or change the submenu if the data in a field in the
parent form is A?

I have one form with two subforms. A teacher (parent form) can only teach
one language. The subforms (classes the teacher teaches) include English and
Spanish. Obviously, one of the subforms will be empty.

I want to have only one subform in my parent form. Can I hide the one that
is empty or change the one showing A to automatically show B? Any ideas
welcome, thanks,

Jeff
 
I have one form with two subforms. A teacher (parent form) can only teach
one language. The subforms (classes the teacher teaches) include English and
Spanish. Obviously, one of the subforms will be empty.

I want to have only one subform in my parent form. Can I hide the one that
is empty or change the one showing A to automatically show B? Any ideas
welcome, thanks,

ummm... why will one subform be empty? More to the point, why do you
have (apparently) two tables for classes? Si la clase es en Español,
es ya una clase!

That said, you can change the SourceObject property of the Subform
control in VBA code in some appropriate event, perhaps the main form's
Current event - determine the teacher's language, and use code like

Private Sub Form_Current()
If Not IsNull(Me!txtTeacherLanguage) Then
Select Case Me!txtTeacherLanguage
Case "English"
Me!subClassSubform.SourceObject = "frmEnglishClasses"
Case "Spanish"
Me!subClassSubform.SourceObject = "frmSpanishClasses"
End Select
End If
End Sub
 
Back
Top