WithEvents in Access 2000
Posted on 2001-09-12
I am TRYING to raise an event from a subform to the parent form. Is this possible? One would think it is.
In my "sub-form", I have an event declaration:
Public Event ValueChanged(NewValue as Variant)
In the code of my sub-form, I raise this event:
I'm pretty sure I'm all set with that side of the problem. Where I get a little mixed up is in the parent form, where the subform is placed.
I create an object variable of type Form_TestSubForm... my form is named TestSubForm, and the code module for it is named Form_TestSubForm, and this is my only choice in the dropdown list when I'm typing:
Private Withevents TestForm As Form_TestSubForm
So, this seems to be okay, because the event list shows the ValueChanged event for my TestForm object. Here's where I run into a problem. What do I set TestForm equal to... i.e. I thought I had it when I said "Set TestForm = TestSubForm.Form", because it didn't give me an error... but it didn't work, either.