Forms and sub-forms

Forms and sub-forms

Suppose we have a form and a sub-form. The form has a drop down field with, for instance, two different data, A and B. A refers to sub-form a and B to sub-form b. Is it possible to show only sub-form a when A is selected (sub-form B being hidden) and sub-form b when B is selected?
Thank you for your help.