[AccessD] Calling an AfterUpdate evnte proc. of a combo

David McAfee davidmcafee at gmail.com
Tue Feb 10 15:18:23 CST 2009


Another thing you can do is create a private (or public if you prefer)
sub that does what the combo box after update event does.

Call that sub in the after update event as well as where else you need
to call it from.



On Mon, Feb 9, 2009 at 10:39 AM, philippe pons <phpons at gmail.com> wrote:
> the proc. is within the form where the combo resides.
> So I'm calling SyncCboTest from the form itself.
>
> Thank's for your help.
>
> NB: yes,  I stay tuned!!!!
>
> 2009/2/9 jwcolby <jwcolby at colbyconsulting.com>
>
>> Philippe,
>>
>> If you go the class route, then you place the AfterUpdate event of the
>> combo in the class itself.
>> Because the AfterUpdate event for THIS SPECIFIC Combo exists in the class
>> itself, then the name
>> never changes(!) and it is within the scope  of the class.
>>
>> Where are you calling SyncCboTest() from?
>>
>> I will be doing a combo class in the lecture that I am doing so stay tuned.
>>
>> John W. Colby
>> www.ColbyConsulting.com
>>
>>
>> philippe pons wrote:
>> > Hi John,
>> >
>> > yes, I know you're a class and withevents guru!
>> > I'll try this way, but if I remenber well your explanations of the
>> > withevents statement, I recall
>> > it allows a class to SINK the event of a control, but can it CALL an
>> event
>> > of tis control, not sure!
>> >
>> > Thank's for your help,
>> >
>> > Philippe
>> >
>> > 2009/2/9 jwcolby <jwcolby at colbyconsulting.com>
>> >
>> >> This is possible, IF the AfterUpdate event exists within the scope of
>> the
>> >> calling subroutine and is
>> >> actually called cbo_AfterUpdate.
>> >>
>> >> If you have a cboPerson and cboState and cboCity then the event to call
>> >> would be
>> >> cboPerson_AfterUpdate, cboState_AfterUpdate, cboCity_AfterUpdate.  You
>> see
>> >> what I am saying?
>> >>
>> >> My guess is the cbo is not CALLED cbo back where it exists.  You are
>> trying
>> >> to use a function to
>> >> make something generic but the NAME of the objects AfterUpdate is not
>> >> generic, and very likely the
>> >> code cannot be seen from this function, the afterupdate sub is in the
>> >> form's class and this function
>> >> is where?  In a module?  Not the same scope.
>> >>
>> >> So no, you probably cannot do what you are trying to do.
>> >>
>> >> Now... if you had a class for your combo...
>> >>
>> >> ;-)
>> >>
>> >> John W. Colby
>> >> www.ColbyConsulting.com
>> >>
>> >>
>> >> philippe pons wrote:
>> >>> Hi all,
>> >>>
>> >>> I have a small proc. to which I pass a reference to a combo box.
>> >>> This proc has to synchronize the combo on the first item
>> >>> and run the AfterUpdate event proc.
>> >>>
>> >>> Private Sub syncCboTest(ByRef cbo As ComboBox)
>> >>>     ' syn de la cbo de sélection du chapitre
>> >>>     cbo.SetFocus
>> >>>     cbo = cbo.ItemData(0)
>> >>> '    Call cboSelChap_AfterUpdate
>> >>>     Call cbo_AfterUpdate '<== this won't work!
>> >>> End Sub
>> >>>
>> >>> The question:
>> >>>
>> >>> How would you call the AfterUpdate event of a combobox that is
>> >> represented
>> >>> by it's reference??
>> >>> something like: cbo_AfterUpdate!
>> >>>
>> >>> If it is even possible!
>> >>>
>> >>> Best regards,
>> >>>
>> >>> Philippe Pons
>> >> --
>> >> AccessD mailing list
>> >> AccessD at databaseadvisors.com
>> >> http://databaseadvisors.com/mailman/listinfo/accessd
>> >> Website: http://www.databaseadvisors.com
>> >>
>> --
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>




More information about the AccessD mailing list