run a forms control events

  • Thread starter Thread starter Wavequation
  • Start date Start date
W

Wavequation

I have a control on a form that runs on the "after update" event. I am using
code from another form to add a value to the control, but if the control is
updated programmatically, the "after update" event code doesn't run. Why
doesn't it run automatically, and what can be done to make it run....
 
I have a control on a form that runs on the "after update" event.  I amusing
code from another form to add a value to the control, but if the control is
updated programmatically, the "after update" event code doesn't run.  Why
doesn't it run automatically, and what can be done to make it run....

It's not designed to run when called from code. You would have to
open the form hidden and call the code from another form.
 
This may be one of those "because that's the way it works" situations.

Rather than wait for the control's AfterUpdate event to fire when you push
in a new value, what about the idea of explicitly telling Access to run that
code?

?Perhaps something like (untested, and not using your controlnames):

Call YourControl_AfterUpdate

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
If you can 'add a value to the control' the Form must be open.

The AfterUpdate event has no system passed arguments so you can call the
Subroutine indirectly with: -

Forms("frmMyOtherForm").NameOfMyTextBoxInAnotherForm_AfterUpdate

NameOfMyTextBoxInAnotherForm_AfterUpdate needs to be Public.
 
Back
Top