I am trying to create a form that contains a subform. But i only want this subform activated when a certain object in a field is chosen, can anyone give me a hand please?
"Activating" a form is what the user does when he/she clicks on it. I guess you mean you want the subform to become visible.
An "object in a field" would be an OLE object in a database field. I guess you mean a form control instead of a field, but what do you mean by an object in a form control? Maybe a particular value from a combo box?
To make a subform visible or invisible depending on what value is chosen in a combo box:
In Design View on the main form, right click on the On Update property for the combo box. Choose Build... and enter the following in the module window:
Private Sub cboMyComboBox_AfterUpdate()
If cboMyComboBox = "<the value that shows the subform>" Then
sbfMySubformControl.Visible = True
Else
sbfMySubformControl.Visible = False
End If
End Sub Rick Sprague
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.