Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sub-form activation and deactivation

Status
Not open for further replies.

DAldridge

Technical User
Jan 24, 2001
6
US
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 = &quot;<the value that shows the subform>&quot; Then
sbfMySubformControl.Visible = True
Else
sbfMySubformControl.Visible = False
End If
End Sub Rick Sprague
 
Thanks for yout help it was exactly what I was after and it worked a treat. Cheers

Dave Aldridge
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top