raiseevent from subform to main form?

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
 
C

Craig Buchanan

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

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top