run a forms control events

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

pietlinden

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

Jeff Boyce

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

ChrisO

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top