raiseevent from subform to main form?

  • Thread starter Thread starter Craig Buchanan
  • Start date Start date
C

Craig Buchanan

I have two forms: Toolbar and Explorer.

In the Toolbar form, I have an image named 'Search'. When I click on it, I
want to raise an event. Here's the code from the Toolbar form:

Public Event SearchClick(Displayed)
Private Sub Search_Click()
RaiseEvent SearchClick(True)
End Sub

I've added the Toolbar form to the Explorer form as a subform. When the
SearchClick event is raised, I want to show or hide the subform based on the
event's parameters. Here's the code from the Explorer form.

Private WithEvents Toolbar As Form_Toolbar
Private Sub Toolbar_SearchClick(Displayed As Variant)
Me.subToolbar.Visible = Displayed
End Sub

For some reason, the Toolbar_SearchClick sub is never executed. What am I
missing?

Thanks,

Craig Buchanann
 
Answered my own question. Needed to add this to main form:

Private Sub Form_Load()
Set Toolbar = Me.subToolbar.Form
End Sub
 
Back
Top