Normally if I want to do something with an event in a control on a form I use "[Event procedure]" and handle it in VBA. So somthing like Private Sub SomeControl_BeforeUpdate(Cancel As Integer) is handled in VBA and the Cancel variable is set there. The control then reacts to the new value of the cancel-variable. Works great.
Now I have a situation where a control is added dynamically on a form. I don't create any VBA but I do set (in design): SomeControl.OnBeforeUpdate = '=GeneralHandler()'
In that public call I then use screen.activecontrol to act on it.
But is it possible to give return values back? So if GeneralHandler() decides that the beforeUpdate should be cancelled, how do I return this variable so that the controls acts in a normal behaviour.
It is not only an issue with BeforeUpdate. Even more with NotInList and all other events with return variables.
Suggestions how to do that?
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.