Replace your Biology, Physics and Chemistry buttons with radio buttons in a frame so that they will be mutually exclusive. Then when cmdDiagram is clicked it's an easy matter to determine which radio button was selected and based on that, to call the appropriate routine.