[AccessD] =function() in .onclick

John W. Colby jwcolby at colbyconsulting.com
Tue Jan 13 04:39:56 CST 2004


I can't help you as to why it sometimes works and others it doesn't.
However I'd like to say I HATE it when developers do this (and I have to
maintain it).  I routinely use the find dialog to find instances of code.
Doing it like that means that I have to use a find and replace utility
instead which is much more intrusive to my development effort.

Another thing is that if you ever intend to use Withevents, they don't fire
unless the words [Event Procedure] are in the property.  If you have an
event stub, you can use withevents (sink the event in a class) and the event
handler in the form at the same time - the event handler in the class simply
gets control first.  Doing it with the function call in the property
prevents sinking that control's events anywhere else.

Now...

If you ever handed that application off to someone like myself (who uses
withevents), I build a class that directly pokes the words [Event Procedure]
into the control's event property (to make sure the event fires) and now MY
class works but your functionality abruptly ceases to work.

Just thought I'd throw that out there.

If I were you I'd probably write a class that handles those checkboxes,
either individually or en mass.

John W. Colby
www.ColbyConsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of
chris at thecube.net
Sent: Tuesday, January 13, 2004 5:24 AM
To: accessd at databaseadvisors.com
Subject: [AccessD] =function() in .onclick


Hi All,

Instead of writing 54 event procedures, i simply iterate through a
collection of checkboxes and set
their AfterUpdate property to a function like so:

for index = 1 to 54
me("chkTemplate" & index).Afterupdate = "=toggleTemplate(" & index & ")"
next

now, on some Access 2000 installs this works fine, yet on others it baulks
at trying to put a
function straight into the event like above.

Am I doing anything wrong?

Cheers

Chris





More information about the AccessD mailing list