Call AfterUpdate of a Control

modest

Registered User.
Local time
Today, 12:31
Joined
Jan 4, 2005
Messages
1,220
It's been a while since I've needed to do something like this:

Code:
For Each ctl In frm.Controls
        If ctl.ControlType = acCheckBox Then
            ctl.Value = False
            [COLOR="Red"]Call frm.Controls(ctl.Name)_AfterUpdate[/COLOR]
        End If
Next ctl


Anyone remember how to call the AfterUpdate sub?
 
How 'bout this:

Call SubNameHere_AfterUpdate
 
Try This...

Code:
Dim strSubName as String
For Each ctl In frm.Controls
        If ctl.ControlType = acCheckBox Then
            ctl.Value = False
            strSubName = str(frm.Controls(ctl.Name)) & "_AfterUpdate"
            Application.Run strSubName 
        End If
Next ctl
 
Hi Modest,
Leave it to you to ask a probing question. I've been playing with it since you posed the question. All I've come up with is a work around so far. As you know, if you make a Sub Public it becomes a method of the form. Making the AfterUpdate event Public I was able to get it to execute with:

Code:
Dim frm As Form
Dim ctl As Control
Dim strSubName As String

Set frm = Me
For Each ctl In frm.Controls
   If ctl.ControlType = acCheckBox Then
      ctl.Value = False
      strSubName = ctl.Name & "_AfterUpdate"
      CallByName frm, strSubName, VbMethod
   End If
Next ctl

Set frm = Nothing
I'm still playing with it.
 

Users who are viewing this thread

Back
Top Bottom