[AccessD] events question

Andy Lacey andy at minstersystems.co.uk
Fri Dec 7 09:21:39 CST 2007


Or highlight all of the controls then in the relevant event specify

=YourProc(Screen.ActiveControl)

(and we're talking against the event in the properties not in an Event
Procedure)

That way you can avoid having to type something different into each control.

The function can then be

Function YourProc(ctl as Control)

and you're away. If you need to know which function triggered it you can
look at ctl.Name.

--
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 question
Date: 07/12/07 16:11


On Dec 7, 2007 10:54 AM, Susan Harkins <ssharkins at gmail.com> wrote:
> I don't know how to summarize this question, hence the bad subject. I
> apologize.
>
> I'm wondering if there's a way to consolidate similar event calls into one
> event. For instance, if you want to passto/call a function from every
> control's Mouse Over event, is there a simple way to do that with one call
> rather than dropping the call into every single control's appropriate
event?

Yes there is.

In the Event that you want to control enter =
YourFunctionName("Param1", "Param2", etc)

And then create a public function

Public Function YourFunctionName (Param1 as variant, param2 as string, etc)

'Code goes here

End Function

Here is an example from an App in use:

I used the On Mouse Move event, so in the Mouse Move event in the
Properties dialog I entered:

=HandleButtonIndent("lblAdd")

Then I have a public function:

Function HandleButtonIndent(ControlName As String)
'--------------------------------------------------------------------------
'.Purpose :
'.Author : Bryan Carbonnell
'.Date : 2004-Mar-17
'.Called by :
'.Calls :
'.Inputs :
'.Output :
'.Revised : 2004-Mar-17 - Original
'--------------------------------------------------------------------------

Dim ctl As Control

On Error GoTo HandleButtonIndent_Error

For Each ctl In Me.Controls
If ctl.Properties("ControlType") = 100 Then
If ctl.SpecialEffect <> 0 Then
ctl.SpecialEffect = 0
End If
End If
Next

If ControlName <> "" Then
Me.Controls(ControlName).SpecialEffect = 2
End If

Exit_HandleButtonIndent:

On Error GoTo 0
Exit Function

'Error Handler
HandleButtonIndent_Error:

With ErrorLog
'Log Error
.LogError "Form_frmIncidentLog", "HandleButtonIndent", _
Err.Number, Err.Description, "Custom Error Message"
'Display Error Message
MsgBox "Error " & .ErrorNumber & " (" & .ErrorDescription & _
") in procedure " & .ProcedureName & " of " & .ModuleName
End With

'Exit the procedure properly
Resume Exit_HandleButtonIndent
'For Debugging
Resume

End Function

--
Bryan Carbonnell - carbonnb at gmail.com
Life's journey is not to arrive at the grave safely in a well
preserved body, but rather to skid in sideways, totally worn out,
shouting "What a great ride!"
--
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