My Assistant
![]() ![]() |
|
|
Apr 4 2012, 06:08 PM
Post
#1
|
|
|
New Member Posts: 5 |
I know that you can call a procedure in a forms module like this:
Call DateEntered_AfterUpdate Where the control name is DateEntered and you want to run the AfterUpdate procedure Does anyone know how to call a procedure of the screen.ActiveControl? I tried: Call Screen.ActiveControl.Name & "_AfterUpdate" Call me.(Screen.ActiveControl.name).AfterUpdate Eval("Call " & Screen.ActiveControl.Name & "_AfterUpdate") None of these seem to work. I want to run this in the Form's Keypress event which has code to update the control to a specific date which does not fire the AfterUpdate event. I'm not even sure if this is possible but have had other occasions where I want to call an event procedure and pass the controls name. Anybody know what the syntax is Or it this is possible? |
|
|
|
Apr 4 2012, 06:18 PM
Post
#2
|
|
|
UtterAccess VIP Posts: 1,857 From: BC, Canada |
Rather than try to invoke an event procedure by name like that, just create public procedures in your form -- these will become effectively methods in the form's class module.
You can then call them directly and your controls' event procedures can also call them. Mike |
|
|
|
Apr 5 2012, 08:25 AM
Post
#3
|
|
|
New Member Posts: 5 |
Thanks, Mike.
I ended up just calling the same function that I was trying to get to run directly instead of via the AfterUpdate of the other control. It just seems like there should be a way to pass the name of the control along with it's event procedure to another procedure. |
|
|
|
Apr 5 2012, 10:50 AM
Post
#4
|
|
|
UtterAccess VIP Posts: 1,857 From: BC, Canada |
Thanks, Mike. I ended up just calling the same function that I was trying to get to run directly instead of via the AfterUpdate of the other control. It just seems like there should be a way to pass the name of the control along with it's event procedure to another procedure. Of course when it comes down to it, all an event procedure is, is a way for you to respond to an event, which is just a message from another object that something has happened. Any time I have anything even moderately complex, or something that might need to be called upon without relying on user interaction with a specific control, I put it into its own procedure, with a name that describes exactly what it does, and then just call that procedure from whatever event procedure(s) I need. It's also more efficient that way, to call a procedure directly. Mike |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 19th June 2013 - 11:34 PM |