[AccessD] Events Collection??

Michael R Mattys michael.mattys at adelphia.net
Tue Oct 19 08:24:53 CDT 2004


----- 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




More information about the AccessD mailing list