[AccessD] Events Collection??

Michael R Mattys michael.mattys at adelphia.net
Tue Oct 19 10:17:38 CDT 2004


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: "Andy Lacey" <andy at minstersystems.co.uk>
> > To: "Access Developers discussion and problem solving"
> > <accessd at databaseadvisors.com>
> > Sent: Tuesday, October 19, 2004 6:42 AM
> > Subject: [AccessD] Events Collection??
> >
> >
> > > Can you enumerate through the event procedures of a form or
control?
> I
> > want
> > > to modify my homespun search routine to look for function calls
> triggered
> > > from an event (not from code), and was wondering if I can do a For
> Each
> > sort
> > > of loop or if I've got to specify each event/
> > > --
> > > Andy Lacey
> > > http://www.minstersystems.co.uk
> >
> > Andy,
> >
> > You can iterate through each Control and Form/Report
> > using a properties loop:
> >
> > Const EVP As String = "[Event Procedure]"
> > 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 "BeforeInsert", "AfterInsert",
> "ApplyFilter"
> >                 IsEvent = True
> >             Case "BeforeUpdate", "AfterUpdate"
> >                 IsEvent = True
> >             Case "BeforeDelConfirm",
"AfterDelConfirm"
> >                 IsEvent = True
> >             Case Else
> >                 If Left(prpName, 2) = "On" 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




More information about the AccessD mailing list