[AccessD] Call AfterUpdate Event From Module

Dan Waters dwaters at usinternet.com
Tue Oct 18 18:50:01 CDT 2005


Thanks Gustav!

You may not believe this, but I only like JC a lot.  After I read his
writings on WithEvents, I decided I just couldn't go any further with the
relationship I thought we had.

Dan  

;-)



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Tuesday, October 18, 2005 2:15 AM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Call AfterUpdate Event From Module

Hi Dan

Not really, as you would have to pass the name of the function as a variable
which you can't (well, sometimes, using Eval() but that can quickly become a
mess).
One method is to move all the AfterUpdate subfunctions to a single
AfterUpdate sub function:

Public Sub ControlAfterUpdate(ByVal strControlName As String)
  Select Case strControlName
    Case "txtDate1"
      Call txtDate1_AfterUpdate
    Case "txtDate2"
      Call txtDate2_AfterUpdate
    '... etc.
  End Select
End Sub

This sub you can call from the outside.
Not fancy but it works.

The fancy method is to implement WithEvents. Highly recommended.
Articles on this can be found on our own site, at Shamil's site, and - if
you don't fall that much in love with JC that you just can't move beyond his
title page - at John Colby's site.

/gustav

>>> dwaters at usinternet.com 18-10-2005 00:39 >>>
I need to call the field's AfterUpdate procedure (which is now Public) to
perform validation, which is different for different date fields.  Is there
a way to do this?

Thanks!
Dan Waters


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