[AccessD] Events Collection??

Andy Lacey andy at minstersystems.co.uk
Tue Oct 19 11:18:47 CDT 2004


Hi Michael
Found what I was doing wrong. My code to iterate through the form used

For Each Doc In Ctr.Documents

The Doc properties do not include the Events. I needed the "Set frm =
Forms(0)", and now I see them. Terrific. Thanks again Michael.

--
Andy Lacey
http://www.minstersystems.co.uk



--------- Original Message --------
From: Access Developers discussion and problem solving
<accessd at databaseadvisors.com>
To: Access Developers discussion and problem solving
<accessd at databaseadvisors.com>
Subject: Re: [AccessD] Events Collection??
Date: 19/10/04 15:22

>
> Andy,
>
> Everything on the Properties Sheet for any object
> is contained within that object's properties collection.
> Try putting a stop in the code where you've written
> (This is DAO code)
>
> Dim frm As Access.Form
> Dim prp As Access.Property
> Set frm = Forms("X")
> For Each prp In frm.Properties
>     Stop
> Next
>
> Now look at the Properties Window in the VBE.
> You should see every event listed under frm.
> What we are looking for is the Name of a property
> that is listed in the Select ... Case structure and if it's
> value equals EVP, then we know that it triggers an
> event.
> ..
> We can also get functions in the property sheet
> that are of the form "=MyFunction()" by simply
> checking the Len() of the prp.Value and whether
> or not it equals EVP or IsNull().
>
> HTH
> ----
>
> Michael R. Mattys
> Mattys MapLib for Microsoft MapPoint
> http://www.mattysconsulting.com
>
>
>
> ----- Original Message -----
> From: "Andy Lacey" <andy at minstersystems.co.uk>
> To: "Access Developers discussion and problem solving"
> <accessd at databaseadvisors.com>
> Sent: Tuesday, October 19, 2004 10:57 AM
> Subject: Re: [AccessD] Events Collection??
>
>
> > Hi Michael
> > That looks great but when I open a form (A97 BTW) and iterate through
its
> > properties I don't see any of the events, just things like its Name,
> > LastUpdated and stuff. What am I doing wrong?
> >
> > --
> > Andy Lacey
> > http://www.minstersystems.co.uk
> >
> >
> >
> > --------- Original Message --------
> > From: Access Developers discussion and problem solving
> > <accessd at databaseadvisors.com>
> > To: Access Developers discussion and problem solving
> > <accessd at databaseadvisors.com>
> > Subject: Re: [AccessD] Events Collection??
> > Date: 19/10/04 13:33
> >
> > >
> > > ----- Original Message -----
> > > From: &quot;Andy Lacey&quot;
&lt;andy at minstersystems.co.uk&gt;
> > > To: &quot;Access Developers discussion and problem
solving&quot;
> > > &lt;accessd at databaseadvisors.com&gt;
> > > Sent: Tuesday, October 19, 2004 6:42 AM
> > > Subject: [AccessD] Events Collection??
> > >
> > >
> > > &gt; Can you enumerate through the event procedures of a
form or
> control?
> > I
> > > want
> > > &gt; to modify my homespun search routine to look for
function calls
> > triggered
> > > &gt; from an event (not from code), and was wondering if I
can do a For
> > Each
> > > sort
> > > &gt; of loop or if I've got to specify each event/
> > > &gt; --
> > > &gt; Andy Lacey
> > > &gt; http://www.minstersystems.co.uk
> > >
> > > Andy,
> > >
> > > You can iterate through each Control and Form/Report
> > > using a properties loop:
> > >
> > > Const EVP As String = &quot;[Event Procedure]&quot;
> > > Dim prp As Access.Property
> > >
> > > For each prp in Obj.Properties
> > >     If IsEvent(prp.Name) Then
> > >         If prp.Value = EVP Then
> > >             '
> > >         End If
> > >     End If
> > > Next
> > >
> > > Function IsEvent(prpName As String) As Boolean
> > > 'Actually, this is a table in one of the A97 Wizards
> > >     IsEvent = False
> > >         Select Case prpName
> > >             Case &quot;BeforeInsert&quot;,
&quot;AfterInsert&quot;,
> > &quot;ApplyFilter&quot;
> > >                 IsEvent = True
> > >             Case &quot;BeforeUpdate&quot;,
&quot;AfterUpdate&quot;
> > >                 IsEvent = True
> > >             Case &quot;BeforeDelConfirm&quot;,
> &quot;AfterDelConfirm&quot;
> > >                 IsEvent = True
> > >             Case Else
> > >                 If Left(prpName, 2) = &quot;On&quot;
Then
> > >                     IsEvent = True
> > >                 End If
> > >         End Select
> > > End Function
> > > ----
> > >
> > > Michael R. Mattys
> > > Mattys MapLib for Microsoft MapPoint
> > > http://www.mattysconsulting.com
> > >
> > > --
> > > _______________________________________________
> > > AccessD mailing list
> > > AccessD at databaseadvisors.com
> > > http://databaseadvisors.com/mailman/listinfo/accessd
> > > Website: http://www.databaseadvisors.com
> > >
> > >
> > >
> > >
> > >
> >
> > ________________________________________________
> > Message sent using UebiMiau 2.7.2
> >
> > --
> > _______________________________________________
> > 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
>
>
>
>
>
>

________________________________________________
Message sent using UebiMiau 2.7.2




More information about the AccessD mailing list