[AccessD] Trapping Events In A Class (custom events as well as built-in)

jwcolby jwcolby at colbyconsulting.com
Wed Aug 8 09:27:47 CDT 2012


Yep, that is what I do as well Charlotte.

John W. Colby
Colby Consulting

Reality is what refuses to go away
when you do not believe in it

On 8/8/2012 10:11 AM, Charlotte Foust wrote:
> And I do it differntly still.  My class accepts a form as an argument in
> it's init routine, which is called from the form.  The form declares a
> variable mFrm as New clsForm and then instantiates the variable  like this:
>
> mFrm.init Me
>
> We all seem to approach it from a slightly different angle depending on
> what we want to do.
>
> Charlotte
>
> On Wed, Aug 8, 2012 at 4:43 AM, A.D. Tejpal <adtp at airtelmail.in> wrote:
>
>>      It is observed that for trapping custom events raised in a form,
>> WithEvents pointer in a new class needs to be declared as that form's class
>> object, as per sample statement below:
>>
>> ' Sample code in class module
>> '==============================
>> Private WithEvents mfm As Form_MyForm
>> '==============================
>>
>>      However, the resulting object does not expose built-in events of the
>> form (like Load, Current etc).
>>
>>      On the other hand, declaring it as Access.Form makes available all the
>> normal events of a form but not the custom events.
>>
>>      For getting access to both sets of events, it is found necessary to
>> set up two separate pointers, one as Access.Form and the other as
>> Form_MyForm.
>>
>>      Could there be a better course of action?
>>
>> Best wishes,
>> A.D. Tejpal
>> ------------
>> --
>> 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